Exporting large figure on headless servers

2 ビュー (過去 30 日間)
Yi-xiao Liu
Yi-xiao Liu 2022 年 7 月 13 日
I am trying to export some large figures (~1e4 by 1e4 surf plots) into bitmap images directly on our HPC cluster. Here is some test script I generated:
n=1e3;
[X,Y,Z] = peaks(n);
fig=figure('visible', 'off');
surf(X,Y,Z,...
"EdgeColor","none","FaceColor","flat")
exportgraphics(fig,"Z.png",'Resolution',1200)
colorbar
caxis([0,10])
daspect([1,1,1e-2])
axis tight
title(append("$\bar{t}=",num2str(0,"%.3f"),"$"),"Interpreter","latex")
fig.CurrentAxes.FontSize=16;
fig.Position = [0,0,6,6];
fig.Units = 'inches';
exportgraphics(fig,"Zm.png",'Resolution',1200)
print(fig,"Zp.png",'-dpng','-r1200')
close(fig)
imshow(imread("Z.png"))
imshow(imread("Zm.png"))
imshow(imread("Zp.png"))
MATLAB was started with -nodisplay -nodesktop -nosplash options.
The problem is that when n is large enough (~1e4) the exporter seems to hang there forever, without any noticable consumption in CPU or RAM. Even for smaller n, the exported images are of crappy resolution, despite I specify a 1200 DPI, as you can view above. I have also attached the output generated on our HPC cluster. Is there anything I can do?

回答 (0 件)

カテゴリ

Find more on Startup and Shutdown in Help Center and File Exchange

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by