edzer / spacetime

Classes and methods for spatio-temporal data
74 stars 20 forks source link

On stplot() #33

Closed JueLinYe closed 6 years ago

JueLinYe commented 6 years ago

Greetings!

I have an stidf (trajectory) element and I am trying to display it with an stplot() function, as described below. However:

Firstly, the cuts where I want the colors to change are not "understood" by the stplot(). Secondly, I am not sure how to show the coordinates on the graph. Thirdly, the code shows an error message on the image: "error using packet, could not find function 'stidf'". Finally, the "name.attr" argument does not respond.

Thank you for your attention! Best regards.

Variable

fileMonth3<-311

load(paste0("Task4_6.",fileMonth3,".RData"));stidf_model<-stidf_SIMAR

layout

m <- map2SpatialLines(map(database="world",xlim = c(-5,10), ylim = c(32,46), plot =F))

proj4string(m) <- "+proj=longlat +datum=WGS84 +ellps=WGS84"

layout1 <- list(list("sp.lines", m, col = "gray"), list("stidf",stidf_model, first = FALSE, cex = 0.5))

plot and save map

pdf(paste0("fileMonth3,".pdf"))

plotting rHs

stplot(stidf_model[1:length(stidf_model@sp),1:nrow(stidf_model@time),2], sp.layout=layout1,number=1,name.attr="var1.pred", at=seq(-1,1,by=0.5)) dev.off()

Task4_6.311.RData.zip rHs.311.pdf