How to get such legend in MATLAB?
조회 수: 1 (최근 30일)
이전 댓글 표시
As you can see in the attached Figure, only 6 legends are used. (not 8 = number of curves).
How to do so?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/757379/image.png)
댓글 수: 0
답변 (1개)
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.
댓글 수: 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!