plot filled rectangle and appear on legend
조회 수: 74 (최근 30일)
이전 댓글 표시
Hi,
I'd like to have something like that

I know that I can use rectangle function, but then it is not appearing on a legend.
Any suggestions how to solve the issue?
댓글 수: 0
채택된 답변
Walter Roberson
2020년 11월 29일
Use fill() such as
fill([xmin xmax xmax xmin], [ymin ymin ymax ymax], 'facecolor', 'y')
댓글 수: 2
Walter Roberson
2020년 12월 13일
Record the handle of one of the fill() calls. Pass only that handle to legend() (along with the handles of any other objects you do wish to legend() )
추가 답변 (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!