Impossible to print *really* vector plots when containing a lot of data
조회 수: 18 (최근 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!