help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plot to PDF


From: Torquil Macdonald Sørensen
Subject: Re: Plot to PDF
Date: Fri, 10 Jul 2009 03:10:36 +0200
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090701)

Ben Abbott wrote:
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 the pdfcairo 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ørensen

It'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.pdf

Ben

Thanks Ben, I will try to explain more thoroughly and provide some files. When using the plot command, a window appears, with certain dimensions. This window is a bit wider than it is tall. I would like the PDF to have the same dimensions.

When I use the print command to obtain an EPS file, the EPS has the same aspect ratio as this window. When printing to PDF, there is lots of extra white space above and below the plot. So the result is not the same when printing to EPS and PDF. So printing to EPS gives the desired result.

(Btw, I assume you meant "print test.pdf", not "plot plot.pdf" in your example code above)

I have uploaded and EPS and a PDF so that the difference can be seen:

* EPS example:

plot (1:10)
print plot.eps

Result: http://folk.uio.no/tmac/plot.eps

* PDF example:

plot (1:10)
print plot.pdf

Result: http://folk.uio.no/tmac/plot.pdf

The EPS has the format that I want, and which is the same as the plot window displayed by octave after the plot command.

The "set(gcf..." you included in the above has the following effect:

EPS case: It affects the aspect ratio of the graphic, as well as the paper format/size.

PDF case: It affects only the graphic, not the page format/size of the PDF file.

Best regards
Torquil Sørensen


reply via email to

[Prev in Thread] Current Thread [Next in Thread]