In adding a plot legend, is there a way to name a legend element with what is contained within a specific cell within a structure?
조회 수: 5 (최근 30일)
이전 댓글 표시
I am trying to plot some data, and am making a loop to do it. There are several data sets I am plotting but in naming the particularly data set (included in the legend), I would name it as what is contained in an element (or cell) within a structure. Is this even possible? Sorry if this is a little confusing.
For example, if what I want to call a particular data set is contained in data(1,3).MTConc, how would I code that?
댓글 수: 0
답변 (2개)
Walter Roberson
2016년 2월 17일
legends = {data(1,3).MTConc, data(2,9).pH, 'Guitar'};
legend(legends);
댓글 수: 0
MHN
2016년 2월 17일
something like this?
x = -pi:pi/20:pi;
y1 = sin(x);
y2 = cos(x);
leg(1).name = 'sin(x)';
leg(2).name = 'cos(x)';
plot(x,y1, '.',x,y2,'.')
legend(leg(1).name,leg(2).name)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!