필터 지우기
필터 지우기

problem when saving plot

조회 수: 3 (최근 30일)
Calvin Cheung
Calvin Cheung 2015년 1월 5일
댓글: Joseph Powe 2020년 3월 16일
Hi there,
I have created a pcolor plot and it can display without any problem. e.g.
f = figure(); h = pcolor(lon, lat, K); set(h,'edgecolor','none');
It has no problem to display on screen, then I save it into file
print('pcolorplot.jpg')
It appears that no content on the plotting area. I tried to print it in PDF, too, but none of these action work.
Attached the screen display and the save files.
Regards,
Calvin

답변 (4개)

Chad Greene
Chad Greene 2015년 1월 6일
편집: Chad Greene 2015년 1월 6일
Try specifying a different renderer with set(gcf,'renderer','opengl'), and if that doesn't work, set(gcf,'renderer','painters') and when you use print include the -painters or -opengl option. And/or use export_fig.
  댓글 수: 2
Calvin Cheung
Calvin Cheung 2015년 1월 7일
Thanks! the set(gcf,'renderer','painters') work and I can save the figure. I also tried other renderer options such as 'opengl' and 'zbuffer' but none of them work for this figure.
Jorge Bosch
Jorge Bosch 2018년 7월 3일
That worked for me too, but using saveas, not export_fig

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


Jorge
Jorge 2015년 1월 5일
Hi! Have you tried using the _saveas() command? Sintax is saveas(figure_handle,'filename.ext') Hope it helps!
  댓글 수: 1
Calvin Cheung
Calvin Cheung 2015년 1월 6일
I tried and save figure as jpg and the first figure was okay, but then when I try save it again, no matter I plot it again or just save the current future to other format such as png or pdf, error occur. Is that a memory issue? seem strange since I am using cluster to run matlab control by my desktop using linux.

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


Image Analyst
Image Analyst 2015년 1월 7일
Why are you using pcolor() instead of imshow()? Did you know pcolor drops off one row and one column? Here's proof:
m = magic(4) % Make 4 by 4 matrix
pcolor(m); % Display 4 by 4 matrix.
colormap(jet(16));
colorbar
  댓글 수: 2
Calvin Cheung
Calvin Cheung 2015년 1월 7일
Thanks for your comments, the problem is my X and Y are not uniform, for example, the upper point would be (5,5), but lower point would be (4.1,3.9). Can I still use imshow in this situation??
Image Analyst
Image Analyst 2015년 1월 7일
Not sure about non-linearity. This is what it says about one of its inputs:
'Xdata' X-axis limits of nondefault spatial coordinate system
two-element vector
X-axis limits of nondefault coordinate system, specified as a two-element vector. This argument establishes a nondefault spatial coordinate system by specifying the image XData. The value can have more than two elements, but imshow uses only the first and last elements.
Example: 'Xdata',[100 200]
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 |
So it looks like it has to be linear, though it can be linear differently in the x and y direction. Though going from 5 to 4.1 can be linear, but it can also be non-linear if the halfway point is not 4.5 but something different like 4.2 or 4.9 or something. Not sure what you have - if it's truly non-linear or if it's just linear but different factors of linear in the x and y direction.

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


Joseph Powe
Joseph Powe 2020년 3월 16일
I can display a color figure on the screen, but when I try to print using the print function using '-dpdf', it comes out black & white.
  댓글 수: 1
Joseph Powe
Joseph Powe 2020년 3월 16일
Never mind, solved it. Didn't notice default was gray scale.

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

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by