[R] bubble plots

Jacques VESLOT jacques.veslot at cirad.fr
Tue Sep 21 09:31:40 CEST 2004

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"

> 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

More information about the R-help mailing list