R/TateyamaVegetationAnalysis.R
plots_5periods_sum.Rd種の被度の時系列変化 (例 ササの経年変化作図) Change of coverage for floral types (life form species)
plots_5periods_sum(data = d, condition = form == "sasa")Summarised tibble.
library(magrittr)
library(tidyr)
#>
#> Attaching package: ‘tidyr’
#> The following object is masked from ‘package:magrittr’:
#>
#> extract
library(dplyr)
library(ggplot2)
d<-plots_5periods_sum(data=vc5,condition=form == "sasa")
#> Error in plots_5periods_sum(data = vc5, condition = form == "sasa"): could not find function "plots_5periods_sum"
# c2〜c5をロング化
d_long <- d %>%
select(plot, c2:c5) %>%
pivot_longer(c2:c5, names_to = "period", values_to = "value") %>%
mutate(period = factor(period, levels = c("c2","c3","c4","c5")))
#> Error: object 'd' not found
# 各plotを別パネル
ggplot(d_long, aes(x = period, y = value, group = plot)) +
geom_line() +
geom_point() +
facet_wrap(~ plot, scales = "free_y") +
labs(x = "Period", y = "Coverage", title = "Change in c2–c5 by plot") +
theme_minimal()
#> Error: object 'd_long' not found
# 1枚で表示
shapes <- c(15, 16, 17, 18, 19, 20, 21, 22, 23)
ggplot(d_long, aes(x = period, y = value,
color = plot,
shape = plot,
group = plot)) +
geom_line() +
geom_point(size = 3) +
scale_shape_manual(values = shapes) +
labs(x = "Period", y = "Coverage",
title = "Change in c2–c5 (all plots)") +
theme_minimal()
#> Error: object 'd_long' not found
#'