Clear Filters
Clear Filters

Question about cropping white space in plot

1 view (last 30 days)
Hello everyone.
Recently I have been generating maps with the code below. However, due to the limitations of my data, said maps are narrow.
Thus, the generated images have wide white edges, which waste plenty of space on my document. I have attempted to implement the solution proposed at https://www.mathworks.com/help/matlab/creating_plots/save-figure-with-minimal-white-space.html. However, the resulting figures don't take into account the labels and I want to keep them in the image.
Can someone please advice me on how to proceed?
All answers are appreciated.
Thanks for reading.
figure
contourf(Y,X, Temperature)
hold on
axesm mercator;
plot(coastlon,coastlat,'k','LineWidth',2)
axis([-125 45 -40 70])
ax = gca; outerpos = ax.OuterPosition; ti = ax.TightInset; left = outerpos(1) + ti(1); bottom = outerpos(2) + ti(2); ax_width = outerpos(3) - ti(1) - ti(3); ax_height = outerpos(4) - ti(2) - ti(4); ax.Position = [left bottom ax_width ax_height];
c2 = colorbar;
xlabel('Longitude(^o)')
ylabel('Latitude(^o)')

Answers (0)

Community Treasure Hunt

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

Start Hunting!