Save plot is not the same as plot on screen

조회 수: 2 (최근 30일)
Colby
Colby 2015년 4월 29일
편집: pfb 2015년 4월 29일
If I have the plot attached as "plot1.png" and run the following two lines of code on it
set(gca,'YTickLabel',num2str(get(gca,'YTick').'))
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.

답변 (2개)

Thorsten
Thorsten 2015년 4월 29일
편집: Thorsten 2015년 4월 29일
Do not set the YTickLabel, use
set(gca, 'YTick', 5000:5000:20000)
  댓글 수: 1
Colby
Colby 2015년 4월 29일
When I use that line it doesn't change my plot on the screen, or the saved plot2 from the original plot1. It still has all four of the original ticks and they're still in scientific notation. And I should maybe add that what I'm trying to accomplish is change tick labels from scientific notation to the full number string. Thank

댓글을 달려면 로그인하십시오.


pfb
pfb 2015년 4월 29일
편집: pfb 2015년 4월 29일
Hi,
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.

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by