MATLAB Answers

How to save a 3D surface plot in 2D view in vector image format?

122 views (last 30 days)
Jian Wen Choong
Jian Wen Choong on 18 Jul 2019
Edited: Bruno Luong on 18 Jul 2019
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 Comments

Sign in to comment.

Answers (2)

Jakob
Jakob on 18 Jul 2019
Edited: Jakob on 18 Jul 2019
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!

  0 Comments

Sign in to comment.


Bruno Luong
Bruno Luong on 18 Jul 2019
Edited: Bruno Luong on 18 Jul 2019
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');

  0 Comments

Sign in to comment.

Sign in to answer this question.