Legend on MATLAB FIGURES

12 vues (au cours des 30 derniers jours)
Bran
Bran le 6 Juil 2015
Réponse apportée : Sid le 7 Juil 2015
I am exporting my MATLAB figures into PDF format. I have altered the size of the figures but when I do so the legend on my graph is too big for the new size. How can I make the legend smaller so it fits nicely into the new graph. Also how can I change the size of the writing. I am using export settings?

Réponses (3)

Thorsten
Thorsten le 6 Juil 2015
h = legend(... % your code here
set(h, 'FontSize', 8); % reduce font size used in legend
  2 commentaires
Bran
Bran le 6 Juil 2015
Is there any way to do this on the actual figure, if you have it already saved
Thorsten
Thorsten le 7 Juil 2015
Modifié(e) : Thorsten le 7 Juil 2015
No, I don't think so.

Connectez-vous pour commenter.


Azzi Abdelmalek
Azzi Abdelmalek le 6 Juil 2015
t=0:0.1:10;
y1=sin(t);
y2=cos(t);
plot(t,y1,t,y2);
leg={'leg1','leg2'},
hleg=legend(leg);
set(hleg,'fontsize',6)
  1 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 6 Juil 2015
Modifié(e) : Azzi Abdelmalek le 6 Juil 2015
To get the legend handle
t=0:0.1:10;
y1=sin(t);
y2=cos(t);
plot(t,y1,t,y2);
leg={'leg1','leg2'},
legend(leg);
h=findobj(gcf,'type','legend')
set(h,'fontsize',20)

Connectez-vous pour commenter.


Sid
Sid le 7 Juil 2015
Perhaps it's a bit out of scope for this topic, but since you mentioned about figures being saved, thought I suggest export_fig at FEX (Link here .)

Community Treasure Hunt

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

Start Hunting!

Translated by