我想ggplot使用facet_grid我的資料型別,其中包含與
只表示0.8會(0.4, 0.4),0.9將(0.45, 0.45)和0,95會(0.35, 0.6)。
.
uj5u.com熱心網友回復:
如果您對完整的 tidyverse 作業流程持開放態度,則可以使用:
library(dplyr)
library(tidyr)
library(ggplot2)
df %>%
pivot_longer(-xx) %>%
mutate(id = as.numeric(gsub("x", "", name))) %>%
arrange(id, xx) %>%
select(-id) %>%
mutate(sd = rep(rep(c(sd = 1, sd = 3, sd = 5, sd = 10), each = 10), each = 3),
phi = rep(rep(list(c(0.4, 0.4), c(0.45, 0.45), c(0.35, 0.6)), each = 10), 4)) %>%
mutate(sd = factor(sd, levels = sd, labels = paste("sd =", sd)),
phi = factor(phi, levels = phi, labels = gsub("c", "", paste("\U03D5 =", phi)))) %>%
ggplot(aes(x = xx, y = value))
geom_line()
geom_point()
scale_y_continuous(expand = c(0.0, 0.00))
labs(x = "Time", y = "Series")
facet_grid(sd ~ phi, scales = "free_y")
theme_bw()
這產生

轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/358887.html
上一篇:在回歸線R中添加 -2SE
下一篇:如何只讓高速公路穿過縣?
