Figures with large amounts of data don't export properly to .eps
10 次查看(过去 30 天)
显示 更早的评论
Equivalent to this previous question (https://se.mathworks.com/matlabcentral/answers/357368-figures-with-large-amounts-of-data-don-t-export-properly-to-eps) I have same issue still.
I don't view the accepted answer of combining a png export with the axis as a solution, it's rather a work-around.
EDIT: MWE for the issue.
clear
N_signals = 21;
N_datapoints = 5000;
A = rand(N_signals,N_datapoints)*2-1;
A = diag(fliplr(1:N_signals)) * A;
t = linspace(0,1,N_datapoints);
figure(1)
clf
plot(t,A)
print('eps_bug', '-depsc')
This code produces a rasterized and compressed image to eps_bug.eps when N_signals = 21, but a nice vectorized image when N_signals = 20 for me.
I have attached 2 pngs showing excerpts of the eps files in SumatraPDF. Also, the file sizes produced by the two variations differ wildly. The N_signals = 20 is 1.7 MB, while N_signals = 21 is 0.3 MB.
END EDIT
Do the people of MATLAB have a solution for this, i.e. a bug fix?
My matlab version:
----------------------------------------------------------------------------------------------------
MATLAB Version: 9.2.0.538062 (R2017a)
MATLAB License Number: xxxxxxxx
Operating System: Microsoft Windows 10 Pro N Version 10.0 (Build 17134)
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB Version 9.2 (R2017a)
3 个评论
ks905383
2019-3-26
I have this problem from time to time as well (as right now) - and every time I forget how to solve it; though given how randomly it shows up, sometimes I feel that it may just randomly dissappear again as well... This mainly happens for me when exporting gridded plots/maps (using pcolorm fo example), and results in 3-4GB plots that crash MATLAB when exporting.
This doesn't happen all the time - in fact, most of the figures I print have similar characteristics - and I have no idea what's going on.
采纳的回答
Bjorn Gustavsson
2019-3-26
The solution to avoid this arbitrary choise of output renderer is to explicitly select painters:
print('-depsc2','-painters',filename)
It is a bit of a mystery as to why matlab selects to use opengl or zbuffer, but in my experience it
works when one explicitly selects "painters" - provided the graph doesn't contain too complicated
3-D structures that confuses the painter.
HTH
3 个评论
Bjorn Gustavsson
2019-3-27
That's "interesting" - I haven't had that problem, yet. I'll cling to my solution and hope I don't get your problem, and hope you refind the solution you've used before...
更多回答(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!