plot filled rectangle and appear on legend
72 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
michael
am 29 Nov. 2020
Kommentiert: Walter Roberson
am 13 Dez. 2020
Hi,
I'd like to have something like that
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/433798/image.png)
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 29 Nov. 2020
Use fill() such as
fill([xmin xmax xmax xmin], [ymin ymin ymax ymax], 'facecolor', 'y')
2 Kommentare
Walter Roberson
am 13 Dez. 2020
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() )
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Legend finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!