Save as SVG not exporting as layers with certain plotting scripts
55 次查看(过去 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.
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!