How to make the legend fully shows in the plot

1 vue (au cours des 30 derniers jours)
Qitao YANG
Qitao YANG le 13 Déc 2019
Commenté : Adam Danz le 13 Déc 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 commentaire
Qitao YANG
Qitao YANG le 13 Déc 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]);

Connectez-vous pour commenter.

Réponse acceptée

Adam Danz
Adam Danz le 13 Déc 2019
Modifié(e) : Adam Danz le 13 Déc 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 commentaires
Qitao YANG
Qitao YANG le 13 Déc 2019
wow, it works! Thank you so much.
Adam Danz
Adam Danz le 13 Déc 2019
Glad I could help out!

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by