matlab crops figures when running with -nodesktop
Show older comments
I'm using matlab R2014b from within a slurm job (with the -nodesktop option).
If I leave the default size and position for the figure and axis, the figure comes out fine, but if I set larger values for the figure position and axis then the figure will be cropped when created from within a slurm job (with -nodesktop), as in the attached.
The problem can be reproduced with this simple code:
mystyle = hgexport('factorystyle');
mystyle.Units='normalized'; % if I leave this to the default (inches) it does't make a difference
mystyle.FontMode='none';
mystyle.Resolution = 100;
fh=figure()
plot([0 1],[0 1]);
set(gcf,'Position',[1 25 1280 669]);
set(gcf,'PaperPosition',[-2.4167 2.0156 13.3333 6.9688]);
set(gca,'Position',[0.1300 0.1135 0.7750 0.8115]);
figure_name='min_example_settingPos';
hgexport(fh,[figure_name '.png'],mystyle,'Format','png');
fh=figure()
plot([0 1],[0 1]);
figure_name='min_example';
hgexport(fh,[figure_name '.png'],mystyle,'Format','png');
I tried to use export_fig instead of hgexport, but the problem persists.

Answers (2)
Fabiano Baroni
on 19 Aug 2016
0 votes
Fabiano Baroni
on 22 Aug 2016
0 votes
Categories
Find more on Startup and Shutdown 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!