[R] several postscript problems

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Oct 3 12:27:20 CEST 2008


On Fri, 3 Oct 2008, Joanne Demmler wrote:

> Hello everyone,
>
> I'm currently trying to export a couple of graphs to pdf . Postscript would 
> be fine too, but I'm using odd page dimensions, which seem to be overwritten 
> when using the "ps2pdf" command. I'm using the pdfpages package in LaTeX to 
> put 6 graphs onto one page (this is why it ought to be a pdf in the end).
>
> I have two problems:
>
> 1. I'm using "arrows" to add error bars to the plots and they come out all 
> misplaced. I've read in older posts that this might be solved using Acrobat 
> Reader, but would this mean that I have to teach LaTeX (Lyx) somehow to use 
> Acrobat too?

Almost certainly a bug in your PDF viewer.  Presumably you are using 
pdftex (the program) as your TeX engine, and that passes the inputted PDF 
code through.  The suggestion is to view the final PDF in Acrobat Reader 
or ghostview, and not viewers based on xpdf.

> 2. I'm also using a legend that includes some dots (pch=1, pch=19), which pdf 
> obviously doesn't understand and plots little q symbols instead (postscript 
> will understand these symbols). Do I have to load a certain font to get it to 
> work?

The problem is not 'pdf' but most likely your broken PDF viewer.  I've 
seen this one a few times.  R 2.8.0 alpha has an option in pdf() to work 
around this particular viewer bug, but do you really want to be using such 
a viewer?

> Joanne
>
>
>> sessionInfo()
> R version 2.7.1 (2008-06-23)

Not current -- see the posting guide!

> i386-redhat-linux-gnu
>
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
>
> Examples:
> R:                pdf("result.pdf",height=4,width=4)
> ...
> ### plot empty window
>  plot(0,0, type="n", ylim=c(-180,180), xlim=c(0,0.5), xlab="", ylab="Phase", 
> xaxt="n", yaxt="n")
>  axis(1,at=seq(0,0.5,0.1),label=rep(" ",6))
>  axis(2,at=seq(-180,180,90))
>  abline(h=0,lty=3)
>  legend("topright",c("annual means", "summer means"),pch=c(19,1),cex=1)
>
> ### plot with error bars in loop
> plot(get(site[j,i])[k,1],get(site[j,i])[k,3],pch=19,axes=F,ann=F,ylim=c(-180,180),xlim=c(0,0.5),col=plotcolour[i])
> arrows(get(site[j,i])[k,1],get(site[j,i])[k,3]+get(site[j,i])[k,4],get(site[j,i])[k,1],get(site[j,i])[k,3]-get(site[j,i])[k,4],length 
> = .03, angle = 90, code = 3,col=plotcolour[i])
> ...
> dev.off()

This is not reproducible, or I would have tried it.

> LaTeX: 
> \includepdf[pages={1-6},pagecommand={\thispagestyle{fancy}\begin{figure}[!b]\caption{test}\end{figure}},nup=2x3,scale=0.75,offset={0.5cm 
> 1cm}]{result.pdf}
>
> ______________________________________________
> 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.
>

-- 
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



More information about the R-help mailing list