R 反转ggplot2中散点图中的大小

R 反转ggplot2中散点图中的大小,r,ggplot2,R,Ggplot2,我有以下代码 plot_S<-ggplot(Sdat, aes(x = Nadd, y = Sratio, size = Variance))+ geom_point(aes(colour=Fert,shape = Fert))+ scale_color_manual(values=c("#2b2b2b", "#838383")) + theme_bw()+ geom_abline(intercept=-0.0107, slope=-0.00

我有以下代码

plot_S<-ggplot(Sdat, aes(x = Nadd, y = Sratio, size = Variance))+
      geom_point(aes(colour=Fert,shape = Fert))+
      scale_color_manual(values=c("#2b2b2b", "#838383")) +
      theme_bw()+
      geom_abline(intercept=-0.0107, slope=-0.0010, colour = "#838383", size = 1.0)+
      geom_abline(intercept=-0.2068, slope=-0.0010, colour="#2b2b2b", size=1.0)+
      labs(x=expression(Delta*"N addition"),y="ln S ratio")
plot_S

plot\u S我们可以对尺寸比例应用变换。
使用虚拟数据集:

library(ggplot2)
ggplot(diamonds, aes(x = depth, y = table, color = cut, size = price)) +
    geom_point()
^正常
比例大小

ggplot(diamonds, aes(x = depth, y = table, color = cut, size = price)) +
    geom_point() +
    scale_size(trans = 'reverse')

^转换后的
scale\u size

谢谢,但在我的例子中,它似乎仍然不能正常工作:您只能获得较大的值(类似于“转换后的
scale\u size
”)。。。我认为,因为我的大多数数据点的“价格”大约为5000(?)。有没有办法在ggplot2中使用三种以上的尺寸?如果您可以提供数据帧的示例,这会更容易。编辑问题并将
dput(Sdat)
的结果放入其中(如果问题太大,则只需头部)
ggplot(diamonds, aes(x = depth, y = table, color = cut, size = price)) +
    geom_point() +
    scale_size(trans = 'reverse')