Save as SVG not exporting as layers with certain plotting scripts

83 ビュー (過去 30 日間)
Alex Hughes
Alex Hughes 2022 年 3 月 29 日
編集済み: Ernesto Rosas 2023 年 8 月 9 日
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 件のコメント
Diego Barría
Diego Barría 2023 年 8 月 9 日
Thanks!
Sebastián Esteban Ojeda Vásquez
Sebastián Esteban Ojeda Vásquez 2023 年 8 月 9 日
Si fuera un polígamo, te cedería una de mis esposas

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModel Import についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by