How to save good quality plots in Matlab using code?
Show older comments
Hi Everyone. I have done few spatial plots in matlab. But, I am facing problem while saving the plots using code. However, during manually saving plots I do not have any problems. For few plots it is fine to save manually, but for large number of plots it is difficult to save one by one plot manually. I am attaching two files along with this question, one of then is saved by code and another is saved manually.
test_1.jpg: It is saved manually
test_2.jpg: It is saved using code
I plotted and saved the code using the following code. In test_1.jpg the plot is showing quite good (it is saved manually by maximize the plotting window), but test_2.jpg is not that good. Please show me some light on this issue. I hope my issue is clear, please let me know if you have any doubt. Thanks in advance. Also, if anyone can tell how to generate good quality plots, for publication/posters that will be really helpful.
for i = 1:1
figure
pcolor(lon, lat, net_all_sky(:, :, i)')
shading interp
colormap("jet")
colorbar
hold on
plot(coastlon, coastlat, "Color", 'k', "LineWidth", 1.5)
plot(coastlon+360, coastlat, "Color", 'k', "LineWidth", 1.5)
grid on
set(gca,'layer','top')
ax = gca;
ax.GridLineWidth = 1.5;
ax.GridAlpha = 0.4;
c = colorbar;
clim([-200 170])
ylabel(c, "TOA short wave flux in Wm^{-2}", "FontSize", 15, "FontWeight", "bold")
title(months(i))
exportgraphics(ax, "test_2.jpg", "Resolution", 300)
end
Accepted Answer
More Answers (0)
Categories
Find more on Images 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!