[R] several postscript problems

Joanne Demmler J.Demmler at swansea.ac.uk
Fri Oct 3 10:40:37 CEST 2008


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?

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?

Joanne


 > sessionInfo()
R version 2.7.1 (2008-06-23)
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()

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}



More information about the R-help mailing list