plot_longest_diagonal | R Documentation |
This function takes a field and plots the longest diagonal of the field. The field is divided into segments and points are sampled from these segments.
plot_longest_diagonal(
field,
n = 8,
type = "random",
n_segments = 2,
distance_field_boundary = 3,
width_diagonal_path = 2
)
field |
An object of class sf representing the field. |
n |
Integer, the number of sample points along the longest diagonal. |
type |
Type of sampling. Default is "random". |
n_segments |
Numeric, the number of segments to divide the longest diagonal (default is 2). |
distance_field_boundary |
Numeric, the distance to buffer the field for creating the boundary (default is 3.0). |
width_diagonal_path |
Numeric, the width to buffer the diagonal path (default is 2.0). |
p: A ggplot object showing the field, the buffered field, the buffered line, and the sample points.
buffered_line: A sf object representing the buffered line.
my_line: A sf object representing the longest diagonal of the field.
sample_points: A sf object representing the sampled points.
length: A numeric value, representing the length of the longest line.
library(sf)
my_sf <- st_read(system.file("shape/gfn_schlaege.shp", package="agricolaeplotr"))
st_crs(my_sf) <- 25832
field <- my_sf[my_sf$SCHLAG_NR == 170,]
plot_longest_diagonal(field)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.