[R-sig-Geo] Blank polygons in stplot

Edoardo Baldoni edoardo.baldoni at gmail.com
Tue May 5 16:24:36 CEST 2015


Thanks Edzer, this package is most useful
and thanks Roman

Edoardo

2015-05-05 20:58 GMT+07:00 Edzer Pebesma <edzer.pebesma at uni-muenster.de>:

>
>
> On 05/05/2015 03:08 PM, Edoardo Baldoni wrote:
> > Hi all,
> >
> > I am using the function stplot to visualize data in STFDFs and find that
> > the function does not seem to work properly when the STFDF is subsetted.
> In
> > particular, the output of the plot function seems to miss some data as
> > SpatialPolygons that should appear as colored are instead just
> > white-colored (blank). Is there any bug in the code or am I missing
> > something ?
> >
> > The  issue can be replicated using the example presented at page 17 of
> the
> > spacetime article in the Journal of Statistical Software:
> >
> > library("spacetime")
> > library("maps")
> > library("plotKML")
> >  states.m <- map("state", plot = FALSE, fill = TRUE)
> > IDs <- sapply(strsplit(states.m$names, ":"), function(x) x[1])
> > library("maptools")
> >  states <- map2SpatialPolygons(states.m, IDs = IDs)
> > yrs <- 1970:1986
> >  time <- as.POSIXct(paste(yrs, "-01-01", sep = ""), tz = "GMT")
> > library("plm")
> > data("Produc")
> > Produc.st <- STFDF(states[-8], time, Produc[order(Produc[2],
> Produc[1]),])
> >  library("RColorBrewer")
> >  stplot(Produc.st[,'1970/1972' , "unemp"], col.regions = SAGA_pal[[4]])
> >
> > The difference between the code above and the one of the article is the
> > color used and the STFDF that here is subsetted. The state of Washington
> in
> > 1971 appears blank while it should be colored according to the palette
> > color. This error comes out with every STFDF I use.
> > Can anyone help me fixing the issue ?
>
> Thanks! For now only specifying "at" will help, as in
>
> stplot(Produc.st[,'1970/1972' , "unemp"], col.regions = SAGA_pal[[4]],
> at = 3:11)
>
> or else update to the spacetime version that fixed this with
>
> devtools::install_github("edzer/spacetime")
>
>
> >
> > Thanks
> >
> > Edoardo
> >
> >       [[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
> >
>
> --
> Edzer Pebesma
> Institute for Geoinformatics (ifgi),  University of Münster,
> Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
> Journal of Statistical Software:   http://www.jstatsoft.org/
> Computers & Geosciences:   http://elsevier.com/locate/cageo/
> Spatial Statistics Society http://www.spatialstatistics.info
>
>
> _______________________________________________
> 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]]



More information about the R-sig-Geo mailing list