ggmap2 | R Documentation |
Read a global raster layer or raster stack and plot on a map
ggmap2( data, name = "", split = FALSE, trans = "identity", facet_grid = FALSE, crop = TRUE, grid = FALSE, colours = colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000"))(255), varnames = NA, subnames = "", outline = NA, extent = NA, ncol = 2, long = FALSE, country = TRUE, save = FALSE, filename = "Rplots.pdf" )
data |
raster layer, raster stack or dataframe |
name |
character, name of legend |
split |
logical, should multiple plots have individual legends or not |
trans |
transform data |
facet_grid |
logical, default to FALSE, if TRUE facet_grid is used for plotting |
crop |
logical, default to TRUE, not implemented right now |
grid |
logical, default to FALSE, if TRUE a grid is added to the plot |
colours |
specify colourPalette used for ggplot2::scale_fill_gradientn() |
varnames |
character vector with names of data |
subnames |
character vector with subnames of data |
outline |
default is NA |
extent |
defaults to NA |
ncol |
specify number of columns for plotting with facet_wrap or ..., not needed if facet_grid is TRUE. |
long |
defaults to FALSE. Specify if data is in long format or not. |
country |
defaults to TRUE. Add country outline to plot. |
save |
defaults to FALSE. Specify if plot should be written to file. |
filename |
If save=TRUE you can specify the filename of your plot here |
ggplot2 object
# Load raster library library(raster) # Create data r <- raster(nrow=90, ncol=180) r <- setValues(r, rnorm(ncell(r), 0, 1)) #Create plots ggmap2(r, name="Single", split=FALSE, ncol=1) ggmap2(r, name="Single", split=FALSE, ncol=1, extent=c(-20, 70, -50, 80))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.