标签: r ggplot2 colors gradient legend
我正在尝试制作一个气泡图表,其中点的颜色是渐变颜色,具体取决于值。我设定的极限值是0.0001到0.1。我的问题是,我希望颜色渐变的图例具有从0.0001到0.001,0.001到0.01和0.01到0.1的相同长度。我写的代码在比例中间代表0.5。 我有这个:
@viewchlid
目前的结果:
期望的结果:
谢谢!
答案 0 :(得分:1)
如何使用:
plot1<- plot1 + scale_fill_gradientn(name = "p-value", trans = "log", breaks = c(0.0001,0.001,0.01,0.1),limits = c(0.0001,0.1),colours=c("red","orange","yellow","grey90"))
输出: