|
From: | Jonathan Stickel |
Subject: | Re: Plot to PDF |
Date: | Fri, 10 Jul 2009 10:24:31 -0600 |
User-agent: | Thunderbird 2.0.0.22 (Macintosh/20090605) |
Ben Abbott wrote:
On Friday, July 10, 2009, at 09:53AM, "Jonathan Stickel" <address@hidden> wrote:On 7/9/09 address@hidden wrote:From: Ben Abbott <address@hidden> Subject: Re: Plot to PDF To: Torquil Macdonald S?rensen <address@hidden> Cc: address@hidden Message-ID: <address@hidden> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes On Jul 9, 2009, at 6:50 PM, Torquil Macdonald S?rensen wrote:Hi! When I plot to pdf in octave, the page format turns out wrong. The resulting PDF looks like an A4 page, even though the actual plot is wider than its height (standard format).I'm using octave 3.2 and the newest gnuplot development snapshot. Plotting to PDF with gnuplot works fine using thepdfcairo terminal. The command I have tried when plotting to pdf in octave is: fplot(blablabla...) print("plot.pdf") It works, apart from that page format issue. Anyone know how to do it right? I'm using the octave3.2 from Debian Sid. Thanks Torquil S?rensenIt's not clear to me what you are seeing, or what you expect to see. So I'll explain what should happen and you can comment. Both pdf an postscript output respect the papersize and paperposition properties. The default are papersize = [8.5, 11]; paperposition = [0.25, 2.5, 8.0, 6.0]; The resulting pdf/postscript output should (approximately) fill a 8x6 in box centered on a page of 8.5x11 inches. If this is what you see, then all is working correctly. If you'd like to produce a pdf to import into a LaTeX document (or a figure for a similar purpose), then try set (gcf, "papersize", [6.4, 4.8]) set (gcf, "paperposition", [0,0, 6.4, 4.8]) plot (1:10) xlabel ("xlabel") ylabel ("ylabel") title ("title") plot test.pdfBenThis makes a nice looking plot, but it is in the lower left corner of an 8.5x11 in page! It seems that the papersize is not being respected. Interestingly, the fonts of the pdf output are nice and large. However, if I subsequently print to eps, the fonts are tiny in the eps output. JonathanThanks for catching the papersize bug. This is due to ghostscript. Presently ghostscript is used to produce a pdf from a postscript output. The postscript is the proper size (per the bounding box) but the resulting pdf is letter size (or perhaps a4). The solution will be to explicitly tell ghostscript the size of the page by using the options ... -dDEVICEWIDTHPOINTS=w -dDEVICEHEIGHTPOINTS=h Where w and h are in points. Another solution is to run the developers version of gnuplot (version >= 4.3). Regarding the eps fontsize, this is a gnuplot feature. I don't have a gnuplot manual handy, but I recall the decreased fontsize is documented. Perhaps we should use ghostscript to convert from ps to eps so that we obtain consistent fontsizes? I'll add these to my list of things that need work. However, my computer is still out for repair and I'm very busy with selling my home, packing, and moving ... it might be a few weeks before I can get to this. So if anyone has the initiative, please dig in. Ben
OK. BTW, a big thanks for all your work on the plotting code.Until this can be fixed within Octave, one workaround is to crop the pdf file after creation. The perl script "pdfcrop" does a good job, and it is included with texlive.
Jonathan
[Prev in Thread] | Current Thread | [Next in Thread] |