how to add legend?
조회 수: 1 (최근 30일)
이전 댓글 표시
hello guys i need help if i have the fallowing plot and i need to add legend but for the small stars and plus the white dots in the cells but when i add the legend it take the colors what should i do ?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155768/image.png)
댓글 수: 2
채택된 답변
Walter Roberson
2016년 8월 15일
In short: create an extra plot handle for each marker type you want to show up in the legend, recording those handles. Use nan as the x and y coordinates when you do that. legend() passing those handles as the first argument.
legend() by default acts on the first plot handles it finds in the figure. In your case that happens to be the hex tiles. You need to tell more specifically which handles are to be legend()'d
댓글 수: 0
추가 답변 (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!