ugly png plots in 3.1.54
John W. Eaton
jwe at octave.org
Thu Mar 12 12:02:39 CDT 2009
On 13-Mar-2009, Ben Abbott wrote:
| On Mar 12, 2009, at 11:24 PM, Francesco Potorti` wrote:
|
| > When printing a plot with print("file.png") the plot is in portrait
| > mode.
| >
| > Until 3.1.51, the default PNG size was a sane 640x480. In 3.1.52 it
| > became 576x432, that is, 90% than before. In 3.1.54 it is 612x792,
| > which is portrait and does not fit well with the landscape format of
| > gnuplot's plots. The relevant gnuplot line is:
| >
| > set terminal png enhanced size 612,792 large;
|
| This is intentional. We've improved compatibility with Matlab.
|
| http://hg.savannah.gnu.org/hgweb/octave/rev/665b264b6a50
|
| > For both PNG and SVG, forcing 640x480 by using
| > print("file.png","-dpng","-S640,480") produces somewhat squashed
| > plots,
| > with too big margins on top and bottom of the plots.
|
| The "squashed" behavior is due to the "paperposition" property.
|
| Try
|
| set (gcf, "paperposition", [0 0 get(gcf,"papersize")])
| print("file.png","-dpng","-S640,480")
|
| ... but you'll get better results with,
|
| set (0, "defaultaxesfontsize", 12)
| set (0, "defaulttextfontsize", 12)
| set (0, "defaultaxesfontname", "*")
| set (0, "defaulttextfontname", "*")
| figure (1)
| clf
| plot (0:10)
| xlabel ("xlabel")
| ylabel ("ylabel")
| title ("title")
| set (gcf, "paperunits", "inches")
| set (gcf, "papersize", [6.4, 4.8])
| set (gcf, "papertype", "<custom>")
| set (gcf, "paperposition", [0, 0, 6.4, 4.8])
| print (gcf, "-dpng", "-r100", "test_100dpi.png")
|
| There is a changeset in work that will improve the positioning of the
| tick-labels, axes-labels and title. It will also produce a font with
| the proper size on the page.
OK.
When we are done, will it be necessary to do all these things to get
reasonble looking output? Is it required when using Matlab?
Shouldn't we be able to get reasonable looking output by default,
without having to specify a lot of properties?
jwe
More information about the Bug-octave
mailing list