How to make the legend fully shows in the plot

1 visualización (últimos 30 días)
Qitao YANG
Qitao YANG el 13 de Dic. de 2019
Comentada: Adam Danz el 13 de Dic. de 2019
There is a problem when drawing the legend. As shown in the picture, the legend is set on top of the figure, but some contents miss. So how can the legend fully be shown in the figure?
untitled.jpg
  1 comentario
Qitao YANG
Qitao YANG el 13 de Dic. de 2019
And I set the legend after the final subplot was made.
Here is the code:
legend({'WC','II','CI','SD'}, 'Orientation','horizontal','location',[0.32,0.97,0.37,0.05]);

Iniciar sesión para comentar.

Respuesta aceptada

Adam Danz
Adam Danz el 13 de Dic. de 2019
Editada: Adam Danz el 13 de Dic. de 2019
Reduce the vertical position of the legend.
legend(. . .,'location',[0.32,0.97,0.37,0.05]);
% [1] [2] [3] [4]
The values above describe
  1. the horizontal placement of the left edge
  2. the vertical placement of the bottom edge
  3. the width
  4. the height
of the legend in normalized units (0:1). Instead of 0.97, try 0.95.
  4 comentarios
Qitao YANG
Qitao YANG el 13 de Dic. de 2019
wow, it works! Thank you so much.
Adam Danz
Adam Danz el 13 de Dic. de 2019
Glad I could help out!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by