Skip to content

Plotting with stplot, mode="xy"

2 messages · Rawlins, Barry G., Edzer Pebesma

#
Hello

I am trying to plot some space-time data which encompasses 3654 time intervals (15 mins each) at 84 sites.

I would like to animate these data and so I have used the following code and my STFDF object is "sp_time":

colors.ten<-rainbow(10,start=0.0,end=0.66) # rainbow color scale
stplot(sp_time, mode="xy", animate=1, cuts=10, at=seq(5,55,5), auto.key=T,col=colors.ten)

The first plot I see is this where the points are plotted in the correct locations:


But, I wanted some bespoke rainbow colors which do not appear and I know the z-range of the data is wider than that shown - the range is actually between 6 and 44. When I run the animation the scale changes each time but I would like it to be fixed so that each time slice has the same scale. Any advice on how I can solve this? I have tried reading the help pages on levelplot but to no avail.

Thanks, Barry
#
Hi Barry, the following should have worked:

library(spacetime)
loadMeuse()
d = as.data.frame(meuse)[c("cadmium", "copper", "lead", "zinc")]
x = STFDF(meuse, Sys.time()+1:4, stack(d))
stplot(x, animate=1, col.regions=bpy.colors(),
   cuts=c(1,10,100,1000,10000))

but doesn't fix the legend with current spacetime on CRAN, as the 'cuts'
argument was not passed on to spplot.

spacetime 0.7-1 in subversion has this fixed.

the 'col' argument needs to be called 'col.regions'.
On 05/28/2012 06:34 PM, Rawlins, Barry G. wrote: