printing figures with development version
Ben Abbott
bpabbott at mac.com
Thu Apr 2 15:50:07 CDT 2009
On Thursday, April 02, 2009, at 02:30PM, "Ivan Sutoris" <ivan.sutoris at gmail.com> wrote:
>Hi
>
>I've stumbled upon another problem with exporting figures in
>development version. Sometimes, after setting 'papersize' and
>'paperposition' property, axes labels are cut off from the figure:
>
>% open new figure
>h = figure;
>
>% figure size in cm, convert to inches
>figsize = [8 6];
>figsize = figsize * 0.39370;
>
>% set paper size and figure position
>set (h, 'papertype', '<custom>')
>set (h, 'paperunits', 'inches');
>set (h, 'papersize', figsize)
>set (h, 'paperposition', [0, 0, figsize])
>
>% plot
>plot(rand(50,1))
>xlabel('t')
>ylabel('X_t')
>
>% print to eps
>print myfig.eps -depsc
>
>Here both axes labels are half-cut from final eps figure. It is
>possible to adjust "position" property of axes object to have more
>space at margins, however that's rather cumbersome (adjustment must be
>done manually for each figure).
>
>I think (if I've understood documentation on Mathworks site correctly)
>that in Matlab this is solved by computing "tightinset" read-only
>property of axes, so that position + tightinset is area that includes
>axes with all associated text objects (and so position can be adjusted
>appropriately). Tightinset is available in Octave but returns zero
>vector, so it's probably not fully implemented. Is there some other
>way?
>
>Regards
>Ivan Sutoris
The problem in your example *may* be a problem with gnuplot, or it may not.
You can check by setting the papersize/paperposition so as to respect the 50pt border that gnuplot places around the figure.
border = 50/72;
% figure size in cm, convert to inches
figsize = [8 6];
figsize = figsize * 0.39370 + 2*border;;
% set paper size and figure position
set (h, 'papertype', '<custom>')
set (h, 'paperunits', 'inches');
set (h, 'papersize', figsize)
set (h, 'paperposition', [border, border, figsize-2*border])
Do you still see the clipping here? It won't surprise me if you do.
Presently, Octave's sources make no effort to control the positioning of the tick-labels, axes-labels, or title. I have a changeset that attempts to, but it reveals new difficulties for Octave+Gnuplot. For the moment, I'm inclinded to leave the job to Gnuplot and invest some more time considering a proper solution. If someone is inclined to take this on, please jump in!
Ben
More information about the Octave-maintainers
mailing list