plot filled rectangle and appear on legend

96 visualizaciones (últimos 30 días)
michael
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
I know that I can use rectangle function, but then it is not appearing on a legend.
Any suggestions how to solve the issue?

Respuesta aceptada

Walter Roberson
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
michael
michael el 13 de Dic. de 2020
If I'm using the fill multiple times, how do I create a legend so that the it will appear only once?
Maybe I shall use the fill in different way?
Walter Roberson
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() )

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R14SP1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by