Save plot is not the same as plot on screen
4 views (last 30 days)
If I have the plot attached as "plot1.png" and run the following two lines of code on it
print('plot2.png', '-dpng', '-r300');
Then my plot on the screen look like the screen shot attached. But when I open the "plot2.png" saved, it looks like the "plot2.png" I've attached. I am plotting several of these plots in a loop, and only a small percentage of them save differently from what is on the screen. Does anyone have any ideas what is going on? I appreciate your time. Thank you.
pfb on 29 Apr 2015
Edited: pfb on 29 Apr 2015
this happens to me too.
I found that I need to specify everything explicitly (XTick, YTick, Xlim, Ylim for the axes, and possibly PaperSize for the figure) in order to prevent matlab from taking initiatives, and obtain a standardized format.
I usually find the values of the above properties that satisfy me for one or two representative figures, and explicitly force them on all of the figures.