[changeset] - compatible behavior when printing

Ben Abbott bpabbott at mac.com
Sat Feb 28 10:00:22 CST 2009


This changeset began with the motive to implement Matlab compatible  
behavior when printing. The preferred implementation sets gnuplot's  
{lrtb}margins present in gnuplot 4.3+, but will also work for the 4.2  
series using "set origin ..." and 'set size ...".

Using default properties, the command below now will now print to a us- 
letter sized canvas (by default) with the plot area occupying the area  
specified by the property "paperposition", which defaults to [0.25 2.5  
8.0 6.0].

print (gcf, "-dpng", "myfile-usletter.png")

To produce a 640x480 bitmap

dpi = get (0, "screenpixelsperinch");
paper_size = [640, 480] ./ dpi;
set (gcf, "paperunits", "inches")
set (gcf, "papertype", "<custom>")
set (gcf, "papersize", paper_size)
set (gcf, "paperposition", [0, 0, paper_size])
print (gcf, "-dpng", "myfile1.png")

Which implies the default resolution is equal to the display. Or the  
resolution may be explicitly specified ...

dpi = 72;
paper_size = [640, 480] ./ dpi;
set (gcf, "paperunits", "inches")
set (gcf, "papertype", "<custom>")
set (gcf, "papersize", paper_size)
set (gcf, "paperposition", [0, 0, paper_size])
print (gcf, "-dpng", sprintf("-r%d", dpi), "myfile2.png")

I've tested tested this changeset with gnuplot 4.2.3 and 4.3, using  
several terminals (-dpsc, -dps, -deps, -dpdf, -dpng). For on screen,  
I've tested with x11, wxt (only on gnuplot 4.2.3), and aqua.

If someone is running gnuplot 4.2.4, please try "rundemos plot" from  
Octave's command line, and let me know if there are any problems.

Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: changeset-paper-props.patch
Type: application/octet-stream
Size: 27543 bytes
Desc: not available
Url : https://www-old.cae.wisc.edu/pipermail/octave-maintainers/attachments/20090228/98215807/attachment-0001.obj 
-------------- next part --------------





More information about the Octave-maintainers mailing list