plot filled rectangle and appear on legend
65 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
michael
il 29 Nov 2020
Commentato: Walter Roberson
il 13 Dic 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 Commenti
Risposta accettata
Walter Roberson
il 29 Nov 2020
Use fill() such as
fill([xmin xmax xmax xmin], [ymin ymin ymax ymax], 'facecolor', 'y')
2 Commenti
Walter Roberson
il 13 Dic 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() )
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Legend in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!