How to get such legend in MATLAB?

2 ビュー (過去 30 日間)
Abdelwahab Afifi
Abdelwahab Afifi 2021 年 10 月 4 日
回答済み: dpb 2021 年 10 月 4 日
As you can see in the attached Figure, only 6 legends are used. (not 8 = number of curves).
How to do so?

回答 (1 件)

dpb
dpb 2021 年 10 月 4 日
Use the 'DisplayName' property for the desired line types to be plotted -- you'll need two lines drawn with just the solid line and four drawn with just the markers for the legend; they can be dummies containing NaN for data but drawn just to create their line handles of the correct styles for legend
Then, when call legend, pass ONLY these line handles.
See the documentation for legend for complete syntax and examples using other than just the default handles.

カテゴリ

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

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by