Impossible to print *really* vector plots when containing a lot of data
10 次查看(过去 30 天)
显示 更早的评论
Hi all!
So, as in the title, my general problem is that, when a plot to-be printed contains really a lot of data (e.g. many thousands of scatter points, or maybe a surface plot with high 2D data resolution) I am not able to print it as a real vector picture with the print command, even if I ask to save it in .eps or .pdf formats.
Experience tells me that it's something that really has to do with the "quantity" of data to be plotted. Look at the plots that I attached here in the .zip.
The first example is a scatter plot: very few points, plot correctly printed as a vector .eps. Using exactly the same code and only adding much more points (the smaller ones, like many thousands), the printed .eps is not vector anymore.
The second example is a 2D plot: only few simple lines, plot correctly printed as a vector .eps. Using exactly the same code and only adding on top a surface plot with quite high resolution (like 600x1200), the printed .eps is not vector anymore.
To me it really seems that the problem is in the printing, not in any other parts of the code. And I don't really understand why, it's just terribly annoying. A partial solution is to call figure.Renderer = 'Painters', and then adding a very high resolution in the print function (like '-r600' or '-r800'). But this does not really solve the problem as it just gives me a raster picture with high resolution (which consequently also tends to be quite heavy).
As simple as it is, I want such plots even with many data points to be really vector.
Any ideas? (Using MATLAB R2021b, but issue present also with previous versions)
5 个评论
Jan
2022-3-18
Alternative, as mentioned in my answer:
exportgraphics(f, 'default.eps'); % Pixel like
f.Renderer = 'painters'
exportgraphics(f, 'vector.eps'); % Better quality
I assume, this does the same internally.
采纳的回答
Jan
2022-3-17
编辑:Jan
2022-3-17
Yes, your oberservation is correct. If the 'RendererMode' of the figure is set to 'auto', Matlab enables the OpenGL renderer if a lot of data are displayed. OpenGL creates pixels graphics, so an export of vector graphics is not possible.
Set the renderer manually to avoid this:
figure('Renderer', 'painters');
This sets the 'RendererMode' to 'manual' automatically.
0 个评论
更多回答(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!