[R-sig-Geo] shapefiles plotting and colouring
Hisaji Ono
hi_ono2001 at ybb.ne.jp
Fri Oct 31 18:03:06 CET 2003
Hi.
I've tried to draw choropleth maps by rmap package as follows.
library(rmap)
mySF <- shapefile("columbus.shp")
crime <- mySF$CRIME
# user-defined legend
classes <- c(50,100,500,1000,5000)
breaks <- length(classes) + 1
classNo <- crime < classes[1]
for(i in 1:(breaks - 1))
classNo <- classNo + (crime >= classes[i] & crime < classes[i + 1]) * i
classNo <- classNo + (crime >= max(classes)) * breaks
plot(mySF, f=gray(1 - classNo/breaks)) # draw map
lines(mySF, col="red") # draw outlines
----- Original Message -----
From: "Paolo Cavallini" <cavallini at faunalia.it>
To: <r-sig-geo at stat.math.ethz.ch>
Sent: Friday, October 31, 2003 11:57 PM
Subject: [R-sig-Geo] shapefiles plotting and colouring
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all.
> it may be a silly question, but: how can I, after reading a shapefile with
the
> appropriate library, draw them with different colours (or grey shades)
> according to different database fields (read through RODBC)? The idea is
> similar to the polygon command, but using shp as polygons and database
fields
> as qualifiers.
> Thanks for any suggestions.
> Ciao.
> paolo
More information about the R-sig-Geo
mailing list