How does one properly save figure with a matlab executable in Linux without the DISPLAY environement variable set?
4 views (last 30 days)
Show older comments
I'm trying to deploy an executable to a Linux machine that does not have X11 installed and on which the DISPLAY environment variable is not set. This Linux installation is one blade of a very large cluster, and the code could be run on any one of those blades. I've been using
h1=figure('visible','off','PaperPositionMode','auto')
hgexport(h1,fname,hgexport('factorystyle'),'format','tiff')
in the normal Matlab GUI environment and the figure is reproduced properly. I've deployed this to a machine with the 'DISPLAY=:0' and this also saves the figure properly. However, if I unset DISPLAY on this deployed machine the figure is no longer saved properly. Doing this reproduces the behavior we see on the Linux blade. The text is mangled and the axes positions are different. The output is very similar to what I get in the normal operating environment if I use a simple
saveas(h1,'text.tif','tif')
or
print(h1,'-dpng','text.png')
without setting PaperPositinMode to 'auto'.
Is there a way to make this work on a Linux machine without setting the DISPLAY variable? Or does this way of saving a figure to a file only work on a machine with X11 installed and the DISPLAY variable set properly? Because of the large number of blades involved, it would be quite a task to install X11 on all of them.
Edit 12/2/2013: For what it's worth, I can reproduce the error by running in the
matlab -nodisplay -nosplash
mode. In this mode I get the same problem and it is insensitive to whether the DISPLAY environment variable is set.
Thanks,
Doug
1 Comment
Answers (1)
See Also
Categories
Find more on Adding custom doc 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!