View source: R/show_shareplot.R View source: R/show_shareplot.R
show_shareplot | R Documentation |
Plot the landscape share in subsequential buffers around a/multiple point(s) of interest
show_shareplot(
landscape,
points,
buffer_width,
max_width = NULL,
multibuffer_df = NULL,
return_df = FALSE
)
show_shareplot(
landscape,
points,
buffer_width,
max_width = NULL,
multibuffer_df = NULL,
return_df = FALSE
)
landscape |
Raster* object |
points |
Point(s) represented by a two-column matrix or data.frame; SpatialPoints*; SpatialPolygons*; SpatialLines; Extent; a numeric vector representing cell numbers; or sf* POINT object |
buffer_width |
Buffer widths in which landscape share is measured.
By default, it is a vector of buffer sizes, if |
max_width |
Max distance to which buffer_width is summed up; the x axis in the plot |
multibuffer_df |
|
return_df |
Logical value indicating if a tibble with the underlying data should be returned |
ggplot2 Object
# create single point
new_point = matrix(c(75,75), ncol = 2)
# show landscape and point of interest
show_landscape(classified_landscape, discrete = TRUE) +
ggplot2::geom_point(data = data.frame(x = new_point[,1], y = new_point[,2]),
ggplot2::aes(x = x, y = y),
col = "grey", size = 3)
# show single point share
show_shareplot(classified_landscape, new_point, 10, 50)
# show multiple points share
new_points = matrix(c(75, 110, 75, 30), ncol = 2)
show_shareplot(classified_landscape, new_points, 10, 50)
# irregular buffer widths
new_points = matrix(c(75, 110, 75, 30), ncol = 2)
show_shareplot(classified_landscape, new_points, c(10, 30, 50))
# get data frame with results back
result <- show_shareplot(classified_landscape, new_points, 10, 50, return_df = TRUE)
result$share_df
# use the output from util_extract_multibuffer
new_points = matrix(c(75, 110, 75, 30), ncol = 2)
df = util_extract_multibuffer(classified_landscape, new_points, 10, 50)
show_shareplot(multibuffer_df = df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.