Legend on MATLAB FIGURES

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?

回答(3 个)

h = legend(... % your code here
set(h, 'FontSize', 8); % reduce font size used in legend

2 个评论

Is there any way to do this on the actual figure, if you have it already saved
Thorsten
Thorsten 2015-7-7
编辑:Thorsten 2015-7-7
No, I don't think so.

请先登录,再进行评论。

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 个评论

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)

请先登录,再进行评论。

Sid
Sid 2015-7-7

0 个投票

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 .)

类别

标签

提问:

2015-7-6

回答:

Sid
2015-7-7

Community Treasure Hunt

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

Start Hunting!

Translated by