[R-sig-Geo] Blank polygons in stplot

Edoardo Baldoni edoardo.baldoni at gmail.com
Tue May 5 15:08:26 CEST 2015


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

Edoardo

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list