你能帮我注释一个ggplot2散点图吗?
对于典型的散点图(黑色):
df <- data.frame(x=seq(1:100), y=sort(rexp(100, 2), decreasing = T))
ggplot(df, aes(x=x, y=y)) + geom_point()
Run Code Online (Sandbox Code Playgroud)
我想以额外的刻度和自定义标签(红色)的形式添加注释:
示例图片:

我希望在我的情节中得到一个破X轴.在x轴上,我喜欢插入一个断轴符号< // >[从2开始到8结束,这意味着2-8将隐藏在< // >符号中],因此可以强调其他值.在Matlab中,此任务通过使用BreakXAxis执行.在R中,plotrix库只能插入一个断轴符号,就是这样.
x <- c(9.45, 8.78, 0.93, 0.47, 0.24, 0.12)
y <- c(10.72, 10.56, 10.35, 10.10, 9.13, 6.72)
z <- c(7.578, 7.456, 6.956, 6.712, 4.832, 3.345)
plot(x, y, col='blue', pch=16, xlab= 'x', ylab='y, z')
points(x, z, col='red', pch=17)
library(plotrix)
axis.break(1,2,style="slash")
Run Code Online (Sandbox Code Playgroud)