Saving figure with large number of data points.
8 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I have a figure with 6 scatter subplots on it, each with a large number of data points on them (unfortunately, I need to show all to capture outliers). The obviously consumes a lot of memory and the situation only worsens when saving using the following:
print -dpdf -r300 example.pdf;
Not only does it take extremely long but when I am finished the pdf is cut oddly and does not match the matlab figure. I setup my figure size with the following:
figure
h1=gcf;
set(h1,'PaperOrientation','portrait');
set(h1,'PaperPosition', [1 1 28 19]);
set(0,'defaultfigurecolor',[1 1 1])
I know matlab is doing some compression in the background but is there a way to make this save more efficient as well as in the correct orientation? I do not like the quality of export_fig but if it is the best option then I have no choice. It is also equally slow.
Thanks!!
0 个评论
采纳的回答
Chris Barnhart
2015-1-19
Try using saveas to save the figure as an image.
These formats would contain one 'int' per pixel, even if many data points were plotted there.
I prefer PNG as JPG could contain artifacts.
Plotting with a marker '.'
>> numpts=1e5; iii=1:numpts; plot( sin(3*pi*iii/numpts)+rand(size(iii)),'.') >> saveas(gcf,'t1.png','png'); saveas(gcf,'t1.pdf','pdf')
t1.pdf ~= 1.5Mb t1.png = 86k
Plotting with lines - the PDF is able to compress some how. t1.pdf = 109k t1.png = 27k
Also, I recall that with older matlabs, the PNG resolution was greater if figure was large on the screen. With 2014b doesn't seem to be that way.
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!