Exporting a figure containing subplots to pdf in exact dimensions

2 次查看(过去 30 天)
Hi, I have been struggling with this issue for quite a long time. I have this code:-
y = -16.55 : 0.01: 16.55;
xpos = 10.5361 * cos(y/10.5361) * (pi/20);
x = [-xpos,xpos];
y = [y,-y];
a1 = subplot(1,4,1);
fill(x,y,'r');
a2 = subplot(1,4,2);
fill(x,y,'g');
a3 = subplot(1,4,3);
fill(x,y,'o');
a4 = subplot(1,4,4);
fill(x,y,'w');
set(a1,'Units','centimeters','Position',[0 0 5 36]);
set(a2,'Units','centimeters','Position',[5.5 0 5 36]);
set(a3,'Units','centimeters','Position',[11 0 5 36]);
set(a4,'Units','centimeters','Position',[16.5 0 5 36]);
I want to export this whole figure to pdf (including the part not visible on screen) in exact dimensions but what is appearing in the pdf is only the part visible on the screen. I checked out this link but this is not working with subplots. Please help.

回答(1 个)

Star Strider
Star Strider 2014-5-26
Experiment with the 'OuterPosition', 'PaperPosition', and other Figure Properties. They seemed a partial solution, but since I don’t know exactly what you want, I will leave you to find the optimal settings for them.
  1 个评论
Soumyadip
Soumyadip 2014-5-26
I just want the entire plot printed in same dimensions, i.e, it should be of length 33.1(2 x 16.55) cm and width as calculated from the equation. Any method would do.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by