Why exporting a figure in pdf changes dimensions of subplots?
4 views (last 30 days)
Hello there. I'm working on my thesis paper. I run into a really annoying problem. I have to export a large number of figures in pdf. The figures are usually 2x2 subplots, each subplot containing square axis 2D maps superimposed by a contour plot.
I report here the code for a single map:
% normal axis ydir
contour(f,f,real(X(:,:,1)),4,'LineColor', [0 0 0]);
axis([1.3 1.7 1.3 1.7]);
For reference, X is a complex 256x256x10 matrix, f is a 256x1 vector containing the x and y axis (that are equal).
When I make all four subplots repeating the code that I wrote previously and I export with the code reported after I get 4 slightly different sized subplots.
fig = gcf;
fig.PaperUnits = 'centimeters';
fig.PaperPosition = [1 1 16 16];
Now. It may seem crazy but I can't stand the difference in size between the generated plots. I need anyways to export my figure in pdf because I need to further elaborate it in a vector graphics software, so please don't propose a bitmap export.
A pdf is attached to the post, so you can get what's the problem.
Thanks in advice and have a nice summer!
Faiz Gouri on 17 Aug 2017
Did you try using the File Exchange contribution export_fig() which is especially suited to exporting figures for use in publications and presentations, because of the high quality and portability of media produced. It also includes a routine to append multiple files into a pdf