# NOT RUN {
# use with ggplot()
df <- fortify(longlake_osm)
ggplot(df, aes(x, y, fill = band1)) + geom_raster() +
coord_fixed()
# }
# NOT RUN {
# identical usage with ggraster()
ggraster(longlake_osm, aes(fill = band1))
# use long format to facet by band
dflong <- fortify(longlake_osm, format = "long")
ggplot(dflong, aes(x, y, fill = value)) +
geom_raster() + facet_wrap(~band) +
coord_fixed()
# can use on other raster types as well
x <- rosm::osm.raster("gatineau qc")
ggraster(x, aes(fill = band1))
df <- fortify(x, format = "long")
ggplot(df, aes(x, y, fill = value)) +
geom_raster() + facet_wrap(~band) +
coord_fixed()
# }
# NOT RUN {
# }
Run the code above in your browser using DataCamp Workspace