printing figures with development version
Ben Abbott
bpabbott at mac.com
Fri Mar 27 13:25:47 CDT 2009
On Friday, March 27, 2009, at 02:12PM, "Ivan Sutoris" <ivan.sutoris at gmail.com> wrote:
>On Fri, Mar 27, 2009 at 6:22 PM, Ben Abbott <bpabbott at mac.com> wrote:
>>
>> On Friday, March 27, 2009, at 01:08PM, "Ivan Sutoris" <ivan.sutoris at gmail.com> wrote:
>>>Hi
>>>
>>>when printing figures to eps files with development version of Octave,
>>>results differ from 3.0.3 - it seems as if the whole paper page was
>>>exported, not just the figure itself, so that there are wider margins
>>>around the figure. This is not so visible with default settings where
>>>the figure fills most of the page, but if I try to decrease it's size
>>>with figure's paperposition property, I get small figure somewhere on
>>>the page and lots of empty space around it. I'm attaching output from
>>>both versions for this simple figure:
>>>
>>>figure
>>>plot(randn(50,1));
>>>print strcat('figtest',version,'.eps') -depsc
>>>
>>>Is this difference expected or is it a bug (or is something messed up
>>>on my end)?
>>>
>>>Regards
>>>Ivan Sutoris
>>>
>>
>> Hi Ivan,
>>
>> What you see is intended. You'll need to adjust the figure's paper properties. Specifically, "papersize" and "paperpositon"
>>
>> If you'd like an 6.4in x 4.8in eps file
>>
>> figure (1)
>> clf
>> plot (randn (50, 1))
>> set (gcf, "paperunits", "inches"); # the default is "inches"
>> paper_size = [6.4, 4.8];
>> set (gcf, "papersize", paper_size)
>> set (gcf, "papertype", "<custom>")
>> set (gcf, "paperposition", [0, 0, paper_size])
>> print (gcf, strcat ("figtest", version, ".eps"), "-depsc")
>>
>> This will be much simpler once the all listeners for these properties are in place.
>>
>> Ben
>>
>
>Thanks, this works well. However, there is another problem - when I
>change paperunits property from inches to centimeters (being European,
>I prefer the metric system :) in above script, I get a huge figure (I
>mean really huge, about 16 by 12 inches).
>
>Regards
>Ivan Sutoris
Much (not all) of the gnuplot backend is written assuming that property lisenters are in place. In thie instance it is assumed that the value for the papesize/position will be automatically changed when the paperunits are changed.
Thus, the backend temporarily sets the paperunits to "inches", assumes the listener handles the conversion, and then sets the paperunits back when print command is done. This would work nicely, except there is not listener in place :-(
I have an m-file implementation that can handle this, but it should be done at a lower level ... and the listener should be activated when the figure is created/initialized, which I understand is done in the c++ sources as well. As my c++ skills are embarassingly weak I'm not confident I know *where* to do this, but am confident I don't know how :-(
... in any event, the short explanation is that you have to use inches at the moment.
Ben
p.s. How are your c++ skills? If you are interested in fixing this, I can provide you with the m-file that handles units conversion for all properties as well as the handling other details related to the paper properties.
More information about the Octave-maintainers
mailing list