Learn R Programming

grainscape (version 0.4.0)

theme_grainscape: A ggplot2 theme for grainscape

Description

A ggplot2 theme designed for grainscape based on the theme_map theme, with several modifications.

Usage

theme_grainscape(base_size = 9, base_family = "")

Arguments

base_size

Base font size

base_family

Base font family

Value

A theme suitable for use with ggplot

See Also

ggGS, plot, theme_map

Examples

Run this code
# NOT RUN {
## Load raster landscape
tiny <- raster::raster(system.file("extdata/tiny.asc", package = "grainscape"))

## Create a resistance surface from a raster using an is-becomes reclassification
tinyCost <- raster::reclassify(tiny, rcl = cbind(c(1, 2, 3, 4), c(1, 5, 10, 12)))

## Produce a patch-based MPG where patches are resistance features=1
tinyPatchMPG <- MPG(cost = tinyCost, patch = tinyCost == 1)

if (interactive()) {
  library(ggplot2)

  ## Plot the patches in a minimum planar graph
  ggplot() +
    geom_tile(ggGS(tinyPatchMPG, "patchId"), mapping = aes(x = x, y = y, fill = value)) +
    theme_grainscape()
}
# }

Run the code above in your browser using DataLab