How to make the legend fully shows in the plot

1 visualizzazione (ultimi 30 giorni)
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 Commento
Qitao YANG
Qitao YANG il 13 Dic 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]);

Accedi per commentare.

Risposta accettata

Adam Danz
Adam Danz il 13 Dic 2019
Modificato: Adam Danz il 13 Dic 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 Commenti
Qitao YANG
Qitao YANG il 13 Dic 2019
wow, it works! Thank you so much.

Accedi per commentare.

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by