【发布时间】:2020-04-26 06:50:27
【问题描述】:
我想在由向量给出的图中添加内部刻度。
说我的向量是myvec <- c(1,3,4:9, 12, 15)
和我的情节:
library(ggplot2)
df <- data.frame(x=seq(1:100), y=sort(rexp(100, 2), decreasing = T))
ggplot(df, aes(x=x, y=y)) + geom_point() +
scale_y_continuous(limits = c(0, 4))
我现在想在x= myvec、y=0 处添加蓝色的内部标记。我该怎么做?
尝试使用此解决方案,但无法使用向量。
Annotate ggplot with an extra tick and label
【问题讨论】: