I use the following function to export some figures to .eps:
p.eps <- function(p, fname, title = NULL, width, height)
{
postscript(file=fname, onefile=FALSE, paper="special",
width=width, height=height, horizontal=FALSE)
print(p + opts(title = title))
dev.off()
}
Whenever I have a page consisting of *only* figures exported in this way,
Acrobat Reader shows them in landscape. If the figures are mixed with
text, the page retains its portrait orientation.
Any ideas on what's going wrong?
postscript problems (landscape orientation)
8 messages · Zeljko Vrba, Brian Ripley, Peter Dalgaard +3 more
On Thu, 21 May 2009, Zeljko Vrba wrote:
I use the following function to export some figures to .eps:
p.eps <- function(p, fname, title = NULL, width, height)
{
postscript(file=fname, onefile=FALSE, paper="special",
width=width, height=height, horizontal=FALSE)
print(p + opts(title = title))
dev.off()
}
Whenever I have a page consisting of *only* figures exported in this way,
Acrobat Reader shows them in landscape. If the figures are mixed with
text, the page retains its portrait orientation.
Any ideas on what's going wrong?
Using Acrobat Reader to view PostScript! It is a PDF viewer. Acrobat Distiller has an auto-rotation option (on by default) when converting PostScript to PDF, which ghostscript later copied. I suspect you need to track down where conversion to PDF is happening and disable auto-rotation.
From ?postscript:
Note:
If you see problems with postscript output, do remember that the
problem is much more likely to be in your viewer than in R. Try
another viewer if possible.
What happened when you followed that request?
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On Thu, May 21, 2009 at 12:32:28PM +0100, Prof Brian Ripley wrote:
Using Acrobat Reader to view PostScript! It is a PDF viewer.
Ah, sorry, I explicitly convert the PS with ghostscript's ps2pdf.
suspect you need to track down where conversion to PDF is happening and disable auto-rotation.
Thanks, I'll search for auto-rotation.
What happened when you followed that request?
People got printed pages in strange orientations.
Zeljko Vrba wrote:
On Thu, May 21, 2009 at 12:32:28PM +0100, Prof Brian Ripley wrote:
Using Acrobat Reader to view PostScript! It is a PDF viewer.
Ah, sorry, I explicitly convert the PS with ghostscript's ps2pdf.
suspect you need to track down where conversion to PDF is happening and disable auto-rotation.
Thanks, I'll search for auto-rotation.
I think the trick is jade:~/> env | grep GS_ GS_OPTIONS=-dAutoRotatePages=/None which I still have on my work login. However, I almost never use PS these days since it is easier just to create the plot files with the pdf() device.
What happened when you followed that request?
People got printed pages in strange orientations.
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
On Thu, May 21, 2009 at 02:14:01PM +0200, Peter Dalgaard wrote:
I think the trick is jade:~/> env | grep GS_ GS_OPTIONS=-dAutoRotatePages=/None
Thanks, I found that myself. However, when using ps2pdf from Miktex 2.7, I get the following error: Unrecoverable error: typecheck in .putdeviceprops I will try to manually invoke gs or, eventually, just use Distiller.
which I still have on my work login. However, I almost never use PS these days since it is easier just to create the plot files with the pdf() device.
Ah, now I remember why I don't use pdflatex: when you re-create the document, the viewer gets _very_ confused, so I have to close and reopen the file and go to the page I was viewing. When I recreate postscript and turn on "Watch file" in ghostview, I get automatic and quick previews of my work.
On Thu, 21 May 2009, Zeljko Vrba wrote:
On Thu, May 21, 2009 at 02:14:01PM +0200, Peter Dalgaard wrote:
I think the trick is jade:~/> env | grep GS_ GS_OPTIONS=-dAutoRotatePages=/None
Thanks, I found that myself. However, when using ps2pdf from Miktex 2.7, I get the following error: Unrecoverable error: typecheck in .putdeviceprops I will try to manually invoke gs or, eventually, just use Distiller.
which I still have on my work login. However, I almost never use PS these days since it is easier just to create the plot files with the pdf() device.
Ah, now I remember why I don't use pdflatex: when you re-create the document, the viewer gets _very_ confused, so I have to close and reopen the file and go to the page I was viewing. When I recreate postscript and turn on "Watch file" in ghostview, I get automatic and quick previews of my work.
Well most people deal with that problem by not using Acrobat to read .pdf files. On linux you can use evince or xpdf. On windows just use gsview32. Those readers don't lock the .pdf. I am with Peter and generally go straight to pdf these days. The only reason for going through postscript is if you want to use psfrag. David Scott _________________________________________________________________ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142, NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.scott at auckland.ac.nz, Fax: +64 9 373 7018 Graduate Officer, Department of Statistics Director of Consulting, Department of Statistics
On 21-May-09 23:02:28, David Scott wrote:
Well most people deal with that problem by not using Acrobat to read .pdf files. On linux you can use evince or xpdf. On windows just use gsview32. Those readers don't lock the .pdf. I am with Peter and generally go straight to pdf these days. The only reason for going through postscript is if you want to use psfrag. David Scott
Going off at a tangent to the original query, I would say that this is too limited a view! For one thing, PostScript (in its Encasulated manifestation) is readily imported and re-scalable by software which does not import PFF. Also, PS is an editable plain-text file (even though there may be chunks in hexadecimal for some graphics -- but it's still ASCII). One thing which I quite often do is edit the "%%BoundingBox: " line to improve the framing of the graphic -- and viewing it in ghostscript with "watch" mode on as one edits, one can easily adjust things to a satisfactory visual effect. If you know what you are doing, you can if you wish move things around, or add or delete things (especially bits of text) by using any plain-text editor on the PostScript file. Finally (though this may be a symptom of serious masochsim on my part), if I download a PDF in which the author has plotted the data, after I "print to file" in PostScript from Acrobat Reader I can usually obtain a very close approximation to the original data values by extracting the PS coordinates of the plotted points (and axis tick-marks) from the PostScript file. "The only reason for going through postscript is if you want to use psfrag" -- or psnup and/or psbook or ... Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 22-May-09 Time: 00:31:32 ------------------------------ XFMail ------------------------------
On May 21, 2009, at 6:31 PM, Ted Harding wrote:
On 21-May-09 23:02:28, David Scott wrote:
Well most people deal with that problem by not using Acrobat to read .pdf files. On linux you can use evince or xpdf. On windows just use gsview32. Those readers don't lock the .pdf. I am with Peter and generally go straight to pdf these days. The only reason for going through postscript is if you want to use psfrag. David Scott
Going off at a tangent to the original query, I would say that this is too limited a view! For one thing, PostScript (in its Encasulated manifestation) is readily imported and re-scalable by software which does not import PFF. Also, PS is an editable plain-text file (even though there may be chunks in hexadecimal for some graphics -- but it's still ASCII). One thing which I quite often do is edit the "%%BoundingBox: " line to improve the framing of the graphic -- and viewing it in ghostscript with "watch" mode on as one edits, one can easily adjust things to a satisfactory visual effect. If you know what you are doing, you can if you wish move things around, or add or delete things (especially bits of text) by using any plain-text editor on the PostScript file. Finally (though this may be a symptom of serious masochsim on my part), if I download a PDF in which the author has plotted the data, after I "print to file" in PostScript from Acrobat Reader I can usually obtain a very close approximation to the original data values by extracting the PS coordinates of the plotted points (and axis tick-marks) from the PostScript file. "The only reason for going through postscript is if you want to use psfrag" -- or psnup and/or psbook or ...
PSTricks (http://www.tug.org/PSTricks/), which I use for creating flow chart types of figures, such as subject disposition charts in clinical trials....in Sweave, I can then fill in text labels in the various boxes using \Sexpr with counts, etc. Examples of use here: http://www.tug.org/PSTricks/main.cgi?file=examples On OSX I find that OSX' Preview works quite well in place of Adobe Reader, save for certain animations in PDF files. Also, for those still reading this thread and are on OSX, if you are not aware, there are additional plugins for QuickLook for EPS files and other such things: http://www.quicklookplugins.com/ HTH, Marc Schwartz