When saving a plot as a vector image, plot lines disappear
7 次查看(过去 30 天)
显示 更早的评论
I am creating a plot in matlab with a grid, when I try to save it as a vector image the plot lines dissapear. Any idea how to solve this?
to save I use
saveas(gcf,'Page1Report.svg')
or
print(gcf,'-vector','-dsvg',['Page1Vector','.svg']) % svg
neither is working. I attach a randerized version of the plot and how is saved as a vector
original plot
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1500535/image.png)
When saved a vector
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1500540/image.png)
0 个评论
回答(1 个)
Abhinaya Kennedy
2024-8-1,4:47
The issue of plot lines disappearing when saving a figure as a vector image in MATLAB can sometimes be related to the renderer being used. MATLAB has different renderers (painters, zbuffer, and opengl), and sometimes switching the renderer can resolve such issues.
Renderer Setting: The set(gcf, 'Renderer', 'painters') command sets the renderer to 'painters'. This renderer is typically used for vector graphics and can help preserve plot lines and other graphical elements when saving as vector images.
If the problem persists, you can also try using the exportgraphics function (https://www.mathworks.com/help/matlab/ref/exportgraphics.html), which is a newer and more versatile function for exporting graphics in MATLAB. The 'ContentType', 'vector' option ensures that the output is a vector graphic.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!