I am SSH connecting to a Linux server and do some MATLAB programming. I would like to save invisible plot as
figH = figure('visible','off') ;
% Plot something
% save the plot as an image with same size as the plot
close(figH) ;
saveas()
and print()
will change the size of the saved image different than the size of plot. Also for print()
, all three renderer modes (-opengl
, -ZBuffer
and -painters
) can not be used in terminal emulation mode on the Linux server. getframe()
doesn't work either.
I wonder how I can solve these problems?
Thanks and regards!
Use the following sequence of commands to connect and start MATLAB:
then a simple plot to illustrate:
I just tried it myself, and it works as expected.
EDIT:
You can always specify the DPI resolution using
-r<number>
, for example a very high resolution:Note that you can use
-r0
to specify screen resolution.Also you can turn on WYSIWYG printing of figures using the
PaperPositionMode
property: