[R-sig-Geo] Contour plot using classIntervals()
Roger Bivand
Roger.Bivand at nhh.no
Sun Nov 6 21:26:33 CET 2011
On Mon, 7 Nov 2011, Ebrahim Jahanshiri wrote:
> I used classInt, classIntervals() to create a classified map of different
> levels. How can I use the same "classIntervals" levels to make a contour or
> filled contour map? and possibly be able to overlay on top of the previous
> plot:
>
> library(RColorBrewer) # creates nice color schemes
> library(classInt) # finds class intervals for continuous variables
> plotvar <- k$Z
> nclr <- 4
> plotclr <- brewer.pal(nclr,"BuPu")
> class <- classIntervals(plotvar, nclr, style="quantile")
> colcode <- findColours(class, plotclr)
> plot(k)
> plot(k, col=colcode, add=T)
>
Look at the contents of your class object - str(class) - the list
component you need is called brks, as you see in the Value: section of the
help page. So class$brks contains the break points found, and may be
passed to contour() and filled.contour() as levels= (untried).
Roger
>
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list