Missing part of my figure when saving as pdf
Show older comments
Some time ago I made a post in whichI asked for a better optimization of the space when saving a figure.
My code now looks as follow:
figure ('Position',[0 0 1200 400]);
subplot(1,2,1)
contourf(Y,X, mediaU3D)
hold on
axesm mercator;
plot(coastlon,coastlat,'k', 'LineWidth', 1.5)
axis([-20 -10 23 32])
c2 = colorbar;
xlabel('Longitude(^o)')
ylabel('Latitude(^o)')
title('X-direction')
subplot(1,2,2)
contourf(Y,X, mediaV3D)
hold on
axesm mercator;
plot(coastlon,coastlat,'k', 'LineWidth', 1.5)
axis([-20 -10 23 32])
c2 = colorbar;
xlabel('Longitude(^o)')
ylabel('Latitude(^o)')
title('Y-direction')
sgtitle('Mean wind velocity (m/s) realizations')
However, when I try to save the figure manually by pressing the save button, see figure1

and try to save it as a pdf. Then, unfortunately I get the result that can be seen in the attached .pdf file, the colorbar of the right subfigure is missing.
Can someone please tell me what am I doing wrong?
Best regards.
Jaime.
2 Comments
Riccardo Scorretti
on 30 Apr 2022
Edited: Riccardo Scorretti
on 30 Apr 2022
Can you post also the variables required to execute the code, so we can play with it? I'm unable to reproduce with randomly generated data.
That's being said, this problem could be linked with paper orientation. Perhaps you could try this before saving the image:
fig = gcf ; fig.PaperOrientation = 'landscape';
Jaime De La Mota Sanchis
on 30 Apr 2022
Accepted Answer
More Answers (0)
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!