# NOT RUN {
# Use method 1.
r=shading_raster(nr=31, nc=60, middle=c(10, 55),
palette=c("darkorange", "red", "purple"))
ggplot()+xlim(0, 8)+ylim(0, 6)+
annotation_raster(r, xmin=-Inf, xmax=Inf,
ymin=-Inf, ymax=Inf, interpolate=TRUE)
# Use method 2.
r=matrix(c(
1, 2, 3, 4, 5, 6, 7, 8,
1, 2, 3, 4, 5, 6, 7, 8,
1, 1, 1, 1, 1, 1, 1, 1),
nrow=3, byrow=TRUE)
r=shading_raster(mat=r, palette=c("green", "blue"))
# }
Run the code above in your browser using DataLab