Save as SVG not exporting as layers with certain plotting scripts

조회 수: 78 (최근 30일)
I have plotted some maps using imagesc and added addition features to the maps using mapshow. When I save this map in .svg format so that I can tweak it in design software it loads the different map elements as editable layers. However, if I use contour to plot contours on the map and then save as an .svg (or .eps) it just saves the whole map as an image which is uneditable. Is this a bug or is there some property I can alter to be able to export the map as editable layers when I apply the contours? Thanks.

채택된 답변

Richard Quist
Richard Quist 2022년 4월 30일
편집: Richard Quist 2022년 5월 1일
When generating vector formats like SVG, MATLAB uses a heuristic to determine how to export the content. In your case it appears that adding the contour has caused the heuristic to choose to embed the content as an image, rather than as "true" vector content. You can override the heuristic by doing one of the following:
% Assuming fig is the handle to the figure you are trying to save...
% set the figure's Renderer property to 'painters' before saving as EPS/SVG:
set(fig, 'Renderer', 'painters');
% If saving as an EPS file, in R2020a and later, you can use the exportgraphics command and specify the 'ContentType' as 'vector':
exportgraphics(fig, 'output.eps', 'ContentType', 'vector');
% For both EPS and SVG, you can use the print command and include the '-painters' option:
print(fig, 'output.svg', '-painters');
I hope that helps.
  댓글 수: 3
Sebastián Esteban Ojeda Vásquez
Si fuera un polígamo, te cedería una de mis esposas

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

추가 답변 (0개)


Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기




Community Treasure Hunt

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

Start Hunting!

Translated by