[R] Help with graphs in A4 size
Duncan Mackay
mackay at northnet.com.au
Tue Feb 26 13:16:58 CET 2013
Hi Eva
Apparently no problem for me with Win 7 as far as I can see. Perhaps
returning to the command window may be a problem?
R version 2.15.2 (2012-10-26)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1]
LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
LC_MONETARY=English_Australia.1252
LC_NUMERIC=C LC_TIME=English_Australia.1252
attached base packages:
[1] datasets utils stats graphics grDevices
grid methods base
other attached packages:
[1]
plotrix_3.4-5 R.oo_1.10.1 R.methodsS3_1.4.2
foreign_0.8-51 chron_2.3-43 MASS_7.3-22
latticeExtra_0.6-24 RColorBrewer_1.0-5
[9] lattice_0.20-10
Now to bed
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au
At 21:45 26/02/2013, you wrote:
>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 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.
More information about the R-help
mailing list