print function with contour too slow
Show older comments
Hi:
I met a problem using 'print' function to print contour to 'jpeg' file. I found some suggestions in web: https://www.mathworks.com/matlabcentral/answers/96864-why-does-the-print-command-take-so-long-with-a-scatter-plot-in-matlab-7-5-r2007b, which suggests to print to 'EPS' format would be faster, however, I tested print both 'jpeg' and 'EPS' format, the result looks quite similar.
is there anyway to optimize this process? I attached a sample for test, the data is the 1st graph in a 3*3 contour, it cost about 90 seconds in my side to print the full graph, in both '.jpeg' and '.eps' format.
the test data 'f.mat' is too large, I compress it to .7z and the .zip, therefore, it requires to extract two times.
Thanks!
Yu
Answers (1)
OCDER
on 1 Aug 2018
Here are the times in my computer. Do you need the '-tiff', '-r600' option for eps file?
tic
print('EPS_test.eps','-depsc2','-opengl');
toc %0.45s
tic
print('EPS_test.eps','-depsc2','-painters');
toc %3.63s
tic
print('EPS_test.eps','-depsc2','-tiff', '-r600');
toc %2.52s
tic
print('EPS_test.jpg','-djpeg', '-r600');
toc %1.12s
13 Comments
OCDER
on 1 Aug 2018
Actually, better to not use clear at all, as that's slow. Also, better practice is use a load with an output.
A = load('f.mat', 'f'); %A.f will be your figure handle
print(A.f, 'EPS_test.eps', '-depsc2')
Yu Li
on 1 Aug 2018
OCDER
on 1 Aug 2018
12 GB RAM + Quad core 3.2 Ghz. You have 96GB RAM + 2.7 GHz, which should be fairly fast. Something is indeed wrong... Update graphics card maybe?
Yu Li
on 1 Aug 2018
OCDER
on 1 Aug 2018
Oh, I meant update graphic card DRIVER, not graphics card. That's a nice computer by the way! 11s saving time is indeed very weird.
Yu Li
on 1 Aug 2018
I'm not too sure about this, but seems like print uses a renderer behind the scene to save an image. opengl vs painters.
And opengl can use GPU for hardware acceleration, if enabled.
See if changing opengl options - hardware vs software help:
Yu Li
on 1 Aug 2018
OCDER
on 1 Aug 2018
I'm running out of idea o_O. -deps/-depsc/-depsc2, -painters are what's left to test for the print options
Maybe this latest driver released Aug 1, 2018 might help? I'll admit, it's a long shot. https://www.geforce.com/drivers/results/136673
If you can't get this resolved, you could try to contact Mathworks directly for support using that Contact Us link.
Yu Li
on 1 Aug 2018
OCDER
on 1 Aug 2018
You're welcome. Hope you find a solution soon! If you do figure it out, post in the Answer section to help others with similar issues.
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!