Skip to content
Prev 9066 / 29559 Next

Mapping multiple attributes at once

Hi Thiago,

My weapon of choice for that would be to use the ggplot2 library.

Here is a quick example. I *hope* it is reproducible (I on't have R
installed on the machine I am posting from):

# here is a sample data frame with locations, a categorical variable
and a continuous variable
dat <- data.frame(x=runif(5), y=runif(5), category=letters(5),
continuous=runif(5))

# You may want to do some spatial analysis on that data.frame
library(sp)
coordinates(dat) <- ~x+y

# Some spatial analysis here

# Now you want to plot it
library(ggplot2)
df <- as.data.frame(dat) # backtransforms dat into a data.frame object
my.plot <- ggplot(data=df, aes(x=x, y=y)) +
geom_point(aes(size=category, fill=continuous))
print(my.plot)

For more info on theggplot2 options see http://had.co.nz/ggplot2/

HTH,

Pierre

2010/8/24 Thiago Veloso <thi_veloso at yahoo.com.br>: