[R-sig-Geo] Colouring hatch lines

Mulholland, Tom Tom.Mulholland at dpi.wa.gov.au
Thu Apr 3 06:14:10 CEST 2008


I might be having finger problems, but I have been unable to get R to
overlay coloured hatching on one of my plots.

This code replicates my problem which I would have thought would have
given me vertical yellow lines.

require(maptools)
require(classInt)
columbus <- readShapePoly(system.file("etc/shapes/columbus.shp",
 package="spdep")[1])
mypal <- c("wheat1", "red3")
f5 <- classIntervals(columbus$CRIME, n=5, style="fisher")
f5Colours <- findColours(f5, mypal)
# or f5Colours <- c("red","green","blue") without classInt
plot(columbus, col = f5Colours)
plot(columbus[which(columbus$HOVAL > 40),], density = 15, angle = 0, add
= TRUE)
plot(columbus[which(columbus$HOVAL > 40),], density = 15, angle = 90,
col = "yellow",add = TRUE)

I am not that well versed with sp:::plot.SpatialPolygons but it looks to
me as if it eventually uses the polygon command which suggests that
'col' will be used for the colour of the hatching if density is given.

Any help would be appreciated as I have exhausted my ideas for keywords
to find any answers to the problem that are already on the list.


I am using
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          2                           
minor          6.2                         
year           2008                        
month          02                          
day            08                          
svn rev        44383                       
language       R                           
version.string R version 2.6.2 (2008-02-08)

Tom Mulholland




More information about the R-sig-Geo mailing list