Re: [R] bubble plots

2004-09-21 Thread Deepayan Sarkar
On Tuesday 21 September 2004 08:41, Edzer Pebesma wrote:
> 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. 

FWIW, In R 2.0.0 (currently beta), you can also do this with 
aspect="iso".

> 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

An alternative would be to change the settings (which is the only way 
the panel function and auto.key can share information). Temporary 
changes in settings can be attached to a trellis object as follows:

xyplot(y~x,groups=z,auto.key=T,asp=diff(range(y))/diff(range(x)),
   par.settings = 
   list(superpose.symbol = list(cex = 2, pch = levels(z

Deepayan

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] bubble plots

2004-09-21 Thread Edzer Pebesma
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] bubble plots

2004-09-21 Thread Jacques VESLOT
Dear all,

I'm used to draw bubble plots (gstat) to get a first view of my spatial
marked data, but I can't find a way to label legend with marks after having
replaced them by a numeric scale.

I have a data frame with numeric coords and factors:

> names(data)
[1] "x" "y" "bloc"  "sub"   "inoc"  "etat"
etc...

> levels(data$etat)
[1] """F"   "Fi"  "NF"  "NFi"


I do:

> levels(data$etat) <- c(0, 2, -2, 1, -1)

> data$etat <- as.numeric(as.vector(data$etat))

> C1 <- subset(data, sub=="C" & bloc=="1", select=c(x, y, etat))

> x11()
> lset(theme = col.whitebg())
> bubble(C1, xcol = 1, ycol = 2, zcol = 3,
xlab = "", ylab = "", main = "Bloc 1  -  Substrat C",
key.entries = min(C1[, 3]):max(C1[, 3]), maxsize=3)

I then obtain "-2", "-1", "O", etc. as legend labels and cannot find
argument making it possible to label my legend with initial marks: "F1",
NFi", etc.

Besides, I also tried with image() but I faced the following error message,
even though I ordered x- and y-coords:

Error in image.default(C1$x, C1$y, C1$etat) :
   increasing x and y values expected

I'd really appreciate if someone could give me either an option to label
adequately bubble plots, or even to make me know if there is another - maybe
better - way to plot spatial marked data.


Jacques VESLOT
CIRAD RĂ©union

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html