Description Usage Arguments Value Examples
merge coordinats with the input data frame by name
1 | sf_polygon(df_geom, df_attri = NULL)
|
df_geom |
A long table with the columns named "name", "x" and "y" (Id and coordinates) for each horizont. For example created by the cord_setting function |
df_attri |
The original table with all variables |
This function returns an set of polygons as simple feature. Each polygon represents a horizon defined by the name
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ##Example1
library(dplyr)
data_example <- data.frame(name = c(1, 2),
from1 = c(0,20),
to1 = c(20, 40)
)
##Coordination setting
cord_example <- cord_setting(data_example, plot_width = 3)
##Plot simple features
plot(sf_polygon(df_geom = cord_example)$geometry)
##Example2
##example data
geom_example <- data.frame(name = c(1, 2),
from1 = c(0,20),
to1 = c(20, 40)
) %>%
cord_setting(plot_width = 3)
attri_example <- data.frame(name = c(1, 2),
rgb_col = c("#6F5F4CFF", "#947650FF"),
nameC = c("Ah", "Bv")
)
##
sf_example <- sf_polygon(df_geom = geom_example, df_attri = attri_example)
##Plot with ggplot
library(ggplot2)
sf_example %>%
ggplot() +
geom_sf(fill = sf_example$rgb_col) +
geom_text(label = sf_example$nameC, x = c(10, 10), y = c(-10,-30)) +
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
panel.background = element_blank())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.