plot filled rectangle and appear on legend
72 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
michael
el 29 de Nov. de 2020
Comentada: Walter Roberson
el 13 de Dic. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 29 de Nov. de 2020
Use fill() such as
fill([xmin xmax xmax xmin], [ymin ymin ymax ymax], 'facecolor', 'y')
2 comentarios
Walter Roberson
el 13 de Dic. de 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() )
Más respuestas (0)
Ver también
Categorías
Más información sobre Legend en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!