View source: R/plotResistance.R
| plotWithResistance | R Documentation |
Places a resistance-surface reference panel (see plotResistance()) to the left of a
network plot – for example one produced by plot() on an mpg or grain object, or
any ggplot2 plot – so the two can be compared at the same size as a visual
sanity check. Both panels are drawn at equal size (using cowplot::plot_grid() with
align = "h" and equal coordinates) and the resistance legend is placed at the far
left.
Requires the cowplot package.
plotWithResistance(x, gg, maxResistance = 12L)
x |
A resistance |
gg |
A plot shown on the right, e.g. the result of |
maxResistance |
Passed to |
A two-panel plot grid produced by cowplot::plot_grid().
Alex M Chubaty
plotResistance()
if (requireNamespace("cowplot", quietly = TRUE)) {
tiny <- terra::rast(
system.file("extdata", "tiny.asc", package = "grainscape", mustWork = TRUE)
)
tinyCost <- terra::classify(tiny, rcl = cbind(c(1, 2, 3, 4), c(1, 5, 10, 12)))
tinyMPG <- MPG(tinyCost, patch = tinyCost == 1)
plotWithResistance(tinyCost, plot(tinyMPG, quick = "mpgPlot", theme = FALSE))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.