Friday 20 December 2019

r - Adding points to levelplot using layer

I am trying to create a plot of precipitation with points where the precipitation is over a certain threshold. I have a data called tp98slice with values 0 or 1 on a 61x101 grid. I want to plot these as points if the value is equal to 1 at each grid point.




I have tried the following code,



levelplot(tpslice ~ lon * lat, data=grid, at=cutpts, cuts=50, pretty=T, 
col.regions=(brewer.pal(9,"Blues")),
xlab="Longitude", ylab="Lattitude") +
layer(sp.points(tp98_pts, pch=ifelse(tp98slice==1, 1, 4), cex=2))


But the layer bit (my points) is not working/showing up.

Current plot

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...