How to label a graph in Matlab without using text command

조회 수: 5 (최근 30일)
Benjamin
Benjamin 2019년 11월 21일
댓글: Walter Roberson 2019년 11월 23일
Hello
I plotted 100 graphs in Matlab using plot function (all in one Figure). I need to label them from 1 to 100. I don't want to/can't use the text command since it requires me to put the X and Y coordinations which is such a hassle and also add at least 100 line to my code.
Is there any way to label graphs, and let Matlab where tu put those labels (numbers in my case)?
Regards,
Benjamin

답변 (1개)

Walter Roberson
Walter Roberson 2019년 11월 21일
If you have a quite new release (R2019a or later I think it is) then you can use legend() with the NumColumns option. The maximum number of legend items per column is 50 if I recall correctly.
100 legend labels takes up quite a bit of space on the screen.
Even if you use different combinations of color and markers and line styles, it is difficult to make 100 distinguishable lines on one plot.
  댓글 수: 2
Benjamin
Benjamin 2019년 11월 22일
Thank you for your response Walter. I have Matlab 2019a and I can make my data to less than 50. However, I am looking for label my curves like ATTACHED PICTURES (1, or 2).
By the way, I know that there is a command regarding labeling contours (clabel) but my curves are simple X and Y plot and NOT contours.
my code is for example like:
for n = 1:40
plot(X(:,n),Y(:,n)
end
regards,
Benjamin

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by