[R] dynamically add items to key of lattice xyplot
hadley wickham
h.wickham at gmail.com
Tue Feb 5 23:12:53 CET 2008
On Feb 5, 2008 3:50 AM, Bram Kuijper <a.l.w.kuijper at rug.nl> wrote:
> Hi all,
>
> is it possible to dynamically add key items to an already existing key,
> belonging to a lattice xyplot?
It's not lattice, but this is pretty easy to do with ggplot2:
install.packages("ggplot2")
library(ggplot2)
qplot(mpg, wt, data=mtcars, colour="1") +
geom_point(aes(x = mpg ^ 2, colour="2")) +
geom_point(aes(x=mpg^3, colour="3")) +
scale_colour_discrete("x power")
each time you add a new layer, all of the scale limits are
recalculated to ensure that all data is displayed. You can read more
about ggplot2 at http://had.co.nz/ggplot2
Hadley
--
http://had.co.nz/
More information about the R-help
mailing list