# Basic usage
grid <- expand.grid(x = 1:10, y = 1:10)
cross <- is.cross(grid$x, grid$y, skip = 2)
with(grid, plot(x, y))
with(grid, points(x[cross], y[cross], col = "red"))
# Its intended use is to highlight areas with geom_subset()
# with reduced densnity. This "hatches" areas with temperature
# over 270K
library(ggplot2)
ggplot(temperature[lev == 500], aes(lon, lat)) +
geom_raster(aes(fill = air)) +
stat_subset(aes(subset = air > 270 & is.cross(lon, lat)),
geom = "point", size = 0.1)
Run the code above in your browser using DataLab