Save as SVG not exporting as layers with certain plotting scripts

59 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Richard Quist
Richard Quist il 30 Apr 2022
Modificato: Richard Quist il 1 Mag 2022
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 Commenti

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Graphics Performance in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by