Hi, 

I need to generate complex graphics which have to be shown in the plot window 
but also in pdf file, and they must have A4 size. This is the reason why I use 
width=8.27 and heigth=11.69.

The problem is that I don't make it runs when I put something (text, lines, and 
so on) outside the plot region. 

I mean if I run the following code, it works perfectly, because the text "My 
title" appears in pdf:

library(plotrix)
graphics.off()
windows(width=8.27, height=11.69)

plot(3:10, main="My title")
###########text(4, 11,"My title")
axis.break()
axis.break(2,2.9,style="zigzag")
mtext("Texto adicional", side=1, line=2)
text(4, 9,"Texto")

dev.copy2pdf(file="Graph.pdf",height=11.69, width=8.27)
shell.exec(file.path(getwd(), "Graph.pdf"))

However, if I use text() to put "My title" (outside the plot region) it seems 
that dev.copy2pdf 
does not make the pdf correctly (it expands the plot and the text "My title" 
does not appear).
I indicate the code I refer to:

library(plotrix)
graphics.off()
windows(width=8.27, height=11.69)

plot(3:10)
#plot(3:10, main="My title")
par(xpd=TRUE)
text(4, 11,"My title")
axis.break()
axis.break(2,2.9,style="zigzag")
mtext("Texto adicional", side=1, line=2)
text(4, 9,"Texto")

dev.copy2pdf(file="Graph.pdf",height=11.69, width=8.27)
shell.exec(file.path(getwd(), "Graph.pdf"))

I have tested using layout with different zones and the results were wrong. 

Some idea about how can I solve it?.

I indicate some important notes:

1) I need to use plotrix package, because of axis.break and addtable2plot 
functions.
2) I can not use ggplot2 packahe, because of incompatibility with other 
functions I have to choose.
3) I would not like to use pdf() and dev.off() as method for the pdf creation. 
I would like to use dev.copy2pdf.

Thank you in advance.


Eva

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to