フィルターのクリア

How to add different legends on a plot

1 回表示 (過去 30 日間)
Reza S
Reza S 2015 年 3 月 7 日
編集済み: Reza S 2015 年 3 月 7 日
Hello,
I have a plot with two different groups of data that each should have a separate handle (See figure attached. the legend on the figure is incorrect).
I made the plot using different properties as plot
(x1,y1,fit_properties{1},'Marker',marker_style{1}) plot (x2,y2,fit_properties{1},'Marker',marker_style{2}) . . plot (xn,yn,fit_properties{2},'Marker',marker_style{1}) .. etc..
I need to have separate legends one for each line style (ls1, ls2, ls3) and the other legend for marker styles that I have four of them (like: ms1, ms2, ms3, ms4)
I do appreciate if one can help on this.
Thanks

回答 (1 件)

Star Strider
Star Strider 2015 年 3 月 7 日
You can only have one legend for each figure, but your lines and markers are sufficiently different so that the legend function should have no problem displaying each uniquely and unambiguously.
  2 件のコメント
Reza S
Reza S 2015 年 3 月 7 日
編集済み: Reza S 2015 年 3 月 7 日
Thank you. You are right that all are sufficiently different but in this way I need to have 12=(4*3) definitions for all. I f I could have 2 legends it would be 7=(4+3). This is more important when the number of cases are increased.
Star Strider
Star Strider 2015 年 3 月 7 日
編集済み: Star Strider 2015 年 3 月 7 日
My pleasure.
The only suggestion I have is to use the subplot function, forcing the same x and y axis limits (using the axis function) for each plot. You can then specify a separate legend for each subplot.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by