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!