[R] legend at fixed distance form the bottom
Greg.Snow at imail.org
Fri Dec 5 18:11:56 CET 2008
It is best to create the graphics device at the final size desired, then do the plotting and add the legend. For getting a fixed distance, look at the function grconvertY for one possibility.
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Christophe Genolini
> Sent: Friday, December 05, 2008 6:40 AM
> To: r-help at r-project.org
> Subject: [R] legend at fixed distance form the bottom
> Hi the list
> I would like to add a legend under a graph but at a fixed distance from
> the graphe. Is it possible ?
> More precisely, here is my code :
> --- 8< ----
> symboles <- c(3,4,5,6)
> dn <- rbind(matrix(rnorm(20),,5),matrix(rnorm(20,2),,5))
> listSymboles <- rep(symboles,each=2)
> legend("bottom", pch = unique(listSymboles), legend = c("ane",
> "poney", "mule"), inset = c(0,-0.175), horiz = TRUE, xpd = NA)
> --- 8< ----
> But when I change the size of the graph, the legend is misplaced.
> Instead, I try to put some text in xlab, but I do not know how to get
> the +, x , V and other symbol.
> Does anyone got a solution ?
> Thanks a lot.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help