How to save a 3D surface plot in 2D view in vector image format?
조회 수: 42 (최근 30일)
이전 댓글 표시
surfc(x,y,z,'LineStyle','none')
view(2)
I try to save it as eps file, but matlab default setting save it as bitmap instead of vector format (it doesn't happen for 2D plot). I then go to Export Setup > Rendering > tick Custom renderer with painter (vector format), but it gives me the contour plot under 3D surface plot. I have tried to use surf() instead, but it gives me a blank graph. I think MatLab saves the XY plane without projection of Z values, instead of the figure in 2D view. Does anyone have an alternative solution? Thanks!
댓글 수: 0
채택된 답변
Bruno Luong
2019년 7월 18일
편집: Eric Sargent
2023년 12월 20일
exportgraphics(gcf,'2D.eps');
(Original answer prior to R2020a):
Try this
h=surfc(peaks,'LineStyle','none');
set(h(2),'LineColor','k');
view(2);
% Make contour-plot on top of the surface
set(gca,'Children',flip(h),'sortmethod','childorder')
set(gcf,'Renderer','Painter')
hgexport(gcf,'2D.eps');
댓글 수: 1
추가 답변 (1개)
Jakob
2019년 7월 18일
편집: Jakob
2019년 7월 18일
There is a very popular function over at the File Exchange: export_fig which deals with correctly exporting figures from Matlab. Maybe this can help you!
댓글 수: 2
Ang Feng
2020년 5월 10일
from R2020a, Matlab allows you export vector graphics by using the exportgraphics function
Chockalingam Senthilnathan
2021년 4월 7일
Worked like a charm for vectorising my 2D view of a surface plot thank you
참고 항목
카테고리
Help Center 및 File Exchange에서 Printing and Saving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!