我有以下数据框:
PhiSize | CumVol | 组 |
---|---|---|
11.40 | 0.08 | 一 |
11.15 | 0.15 | 一 |
10.91 | 0.21 | 一 |
10.68 | 0.25 | b |
10.44 | 0.29 | b |
10.20 | 0.32 | c |
9.95 | 0.38 | c |
我想要绘制的是一个线图,它有一个像上面那样的辅助轴:
到目前为止我做到了
library(ggplot2)
df <- data.frame(read_csv("file")
ggplot(aes(x = PhiSize, y = CumVol, color = Group ), data = df) +
geom_line() +
scale_x_reverse()
但是当我添加最后一行时:
ggplot(aes(x = PhiSize, y = CumVol, color = Group ), data = df) +
geom_line() +
scale_x_reverse()+
sec_axis(2^(-df$PhiSize),name = "new")
它抛出:
<块引用>错误:无法将双向量转换为函数
我想得到一些帮助,拜托。