[R] Positioning text in top left corner of plot

538280 at gmail.com 538280 at gmail.com
Tue Feb 7 21:55:35 CET 2012


You might want to look at the grconvertX and grconvertY functions.
You can use them to convert a coordinate relative to the plotting
device (screen, paper) or plotting region to user coordinates to use
with text or mtext.

On Tue, Feb 7, 2012 at 4:06 AM, Manta <mantino84 at libero.it> wrote:
> Dear all,
>
> another questions related to zoo plotting. I would like to do as in the
> subject. Here a reproducible code:
>
> library(zoo)
> par(mfrow=c(2,1)
> plot(zoo(seq(1:10),as.Date(seq(1:10),origin="1970-01-01")),xlab="",ylab="",main="Value",las=1)
> mtext("EUR billions",adj=0,cex=0.7)
> plot(zoo(seq(1:10),as.Date(seq(1:10),origin="1970-01-01")),xlab="",ylab="",main="Value",las=1)
> par(xpd=T)
> text(par("usr")[1],par("usr")[3]+10.5,"EUR billions",cex=0.7)
>
> In the first graph I use the mtext function, which does the trick but it
> places the text too close too the y-axis.
> A second possibility is to use the text function, prior specification of the
> option parameter par(xpd=T). However, this does not look consistent as,
> depending on the graph, I would need to add different numbers in the y
> specification of the axis (par("usr")[3]+XXX).
>
> Any idea?
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Positioning-text-in-top-left-corner-of-plot-tp831723p4364355.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.



-- 
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com



More information about the R-help mailing list