Legend on MATLAB FIGURES

5 次查看(过去 30 天)
Bran
Bran 2015-7-6
回答: Sid 2015-7-7
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 个)

Thorsten
Thorsten 2015-7-6
h = legend(... % your code here
set(h, 'FontSize', 8); % reduce font size used in legend
  2 个评论
Bran
Bran 2015-7-6
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.

请先登录,再进行评论。


Azzi Abdelmalek
Azzi Abdelmalek 2015-7-6
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 个评论
Azzi Abdelmalek
Azzi Abdelmalek 2015-7-6
编辑:Azzi Abdelmalek 2015-7-6
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
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 .)

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by