我有一個資料框:
df <- data.frame(tw = rep(c(1:30), each = 3),
name = rep(c("spec1", "spec2", "spec3"), each = 1),
id = rep(c(1:10), each = 90),
value = sample(x = 0:100, size = 900, replace = TRUE))
其中tw(time window)表示時間單位,但不是等間隔的。從 tw 1:25 開始是每 500 年,而從 tw 26 - 30 開始是每 ~ 1500 年。
目前我正在這樣繪制它:
library(ggplot2)
ggplot()
geom_line(data=df, aes(x=tw, y=value, group=interaction(id, name), colour=name), alpha = .15)
scale_x_reverse(breaks = scales::pretty_breaks(n = 15))
scale_colour_manual(values = c("#ffa644", "#30460a", "#E64056"))
geom_vline(xintercept = 25, )
ylab("Percentage (%)")
xlab("Time")
labs(colour = "Taxa")
theme_bw()
我希望 tws 26:30(截取線之前)沿 x 軸的間隔比 1:25 更遠,以表示更長的時間間隔。我試圖在下面畫一個例子。

轉載請註明出處,本文鏈接:https://www.uj5u.com/net/534932.html
標籤:r图表2
