[R-sig-Geo] Help with spplot

Pierre Roudier pierre.roudier at gmail.com
Thu Jun 9 01:38:15 CEST 2011


Hi Mathieu,

In the code snippet I posted, I just created two treillis objects, p1
and p2. Those are sort of plots objects. I then plot then in a canvas
in the plot command. The split option is simply to split the canvas in
two views, one for each plot p1 and p2. The "more" option simply lets
the canvas open for more stuff to be plotted if TRUE. When set to
FALSE, it closes the canvas - you can't add any more plot to it.

Nice to hear from you here!

Pierre

2011/6/9 Mathieu Rajerison <mathieu.rajerison at gmail.com>:
> Hello Pierre ;-)
>
>
> What's the purpose of using options split and more in plot() function?
>
>
> Thanks,
>
>
> "ex same class in school" Mathieu
>
> 2011/6/8 Pierre Roudier <pierre.roudier at gmail.com>
>
>> Hello Aritra,
>>
>> If you want just the CRESS_ID column to be plotted, try:
>>
>> spplot(nc, zcol = "CRESS_ID", col.regions = heat.colors(64))
>>
>> If you want to have both maps on the plot:
>>
>> p1 <-  spplot(nc, "CRESS_ID", col.regions = heat.colors(64))
>> p2 <-  spplot(nc, "both", col.regions = sample(rainbow(nboth)))
>> plot(p1, split=c(1,1, 2,1), more=TRUE)
>> plot(p2, split=c(2,1,2,1), more=FALSE)
>>
>> HTH,
>>
>> Pierre
>>
>> 2011/6/9 Aritra Sengupta <aritra.sourav at gmail.com>:
>> > Hello,
>> >
>> > I am trying to plot the map of NC and using a color scheme. I have done
>> that
>> > using spplot().
>> >
>> > Here is a code (reference: Introduction to the North Carolina SIDS data
>> > set (revised), Roger Bivand, April 12, 2011)
>> >
>> > library(sp)
>> > library(maptools)
>> > library(spdep)
>> > nc_file <- system.file("etc/shapes/sids.shp", package = "spdep")[1]
>> > llCRS <- CRS("+proj=longlat +datum=NAD27")
>> > nc <- readShapeSpatial(nc_file, ID = "FIPSNO", proj4string = llCRS)
>> >
>> > nc$both <- factor(paste(nc$L_id, nc$M_id, sep = ":"))
>> > nboth <- length(table(unclass(nc$both)))
>> > spplot(nc, "both", col.regions = sample(rainbow(nboth)))
>> >
>> > Now I want to have the county index (CRESS_ID in nc) for each county,
>> > plotted on the same map. I have not been able to figure out how to do it
>> :(
>> >
>> > Any help/suggestion will be greatly appreciated.
>> >
>> > Thanks.
>> >
>> > -Aritra
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> > _______________________________________________
>> > R-sig-Geo mailing list
>> > R-sig-Geo at r-project.org
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >
>>
>>
>>
>> --
>> Scientist
>> Landcare Research, New Zealand
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
Scientist
Landcare Research, New Zealand



More information about the R-sig-Geo mailing list