As an update, I think that this problem is likely to be related to a known failure of matlab to take into account resolution settings when exporting to png and other formats while running with the -nodesktop option:
matlab crops figures when running with -nodesktop
4 views (last 30 days)
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.
0 Comments
Answers (2)
See Also
Categories
Find more on Environment and Settings 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!