[R] bubble plots
Edzer Pebesma
e.j.pebesma at zonnet.nl
Tue Sep 21 15:41:44 CEST 2004
Jacques, please try the following:
> z=factor(c('a', 'b','c'))
> z
[1] a b c
Levels: a b c
> x = c(1,2,3)
> y = c(3,2,1)
> xyplot(y~x,groups=z,auto.key=T,asp=diff(range(y))/diff(range(x)))
the asp argument takes care of one unit in x being equal to one unit in y.
If you add e.g. pch=z to vary symbols, auto.key will have to be replaced
by the more complex key argument, see ?xyplot
Color and symbol type are better to distinguish factor variables than
size is, so I'd recommend using xyplot rather than bubble (which uses
xyplot to plot bubbles)
--
Edzer
More information about the R-help
mailing list