Description Usage Arguments Author(s) Examples
Produces an object to feed into ggplot geom_raster or geom_tile to produce a rgb plot
1 | ggRGB(x, r, g, b)
|
x |
RasterStackBrick object |
r |
Numeric Band number to be plotted in red |
g |
Numeric Band number to be plotted in green |
b |
Numeric Band number to be plotted in blue |
Loic Dutrieux (using some code snippets by Josh Gray and Robert Hijmans)
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(ggplot2)
library(raster)
x <- brick(system.file("external/rlogo.grd", package="raster"))
ggrgb <- ggRGB(x, 3,2,1)
ggplot() +
geom_raster(data = ggrgb, aes(x=x, y=y, fill=values)) +
scale_fill_identity() +
coord_equal() +
scale_x_continuous(name = 'Lat', expand=c(0, 0)) +
scale_y_continuous(name = 'Long', expand=c(0, 0))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.