Export_fig legend issue where legend items are very close to each other

1 回表示 (過去 30 日間)
A
A 2015 年 1 月 2 日
編集済み: A 2015 年 1 月 2 日
When I try to graph the below surface with a 'horizontal' 'north' legend, the tif file that is exported from export_fig has an issue where the horizontal legend items are squished up with each other such that they are almost overlapping. Is there a way to add some padding between the legend items? Maybe an extra space or something? Thanks.
x = [-10:10];
y = [-10:10];
Eq1 = @(x,y)(x + y);
Eq2 = @(x,y)(2.*x + y);
Eq3 = @(x,y)(3.*x + y);
Eq4 = @(x,y)(4.*x + y);
[X,Y] = meshgrid(x,y);
Z1 = Eq1(X,Y);
Z2 = Eq2(X,Y);
Z3 = Eq3(X,Y);
Z4 = Eq4(X,Y);
figure(1)
s1 = surf(X,Y,Z1);
hold on
s2 = surf(X,Y,Z2);
s3 = surf(X,Y,Z3)
s4 = surf(X,Y,Z4);
hold off
legend('Equation One','Equation Two','Equation Three','Equation Four','Location','north','Orientation','horizontal')
legend('boxoff')
export_fig Legend_Issue.tiff -m3 -q101 -nocrop

回答 (1 件)

Montree
Montree 2015 年 1 月 2 日
use 'Location' or 'Position' for control the position of legend. for more example please see in matlab help. (search 'legend' in help)
  1 件のコメント
A
A 2015 年 1 月 2 日
編集済み: A 2015 年 1 月 2 日
The location and position allows me to 1) describe the location of the box and 2) describe the width and the height of the box.
It does not allow me to change the size of the legend color boxes, add padding, or spacing between legend items.
Thoughts?
P.S. I had a follow-up question in my other thread, not sure if you'd seen it since I accepted your answer: http://uk.mathworks.com/matlabcentral/answers/168756-want-to-make-changes-to-the-colorbar

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by