asymmetric color distribution in scale_gradient2?

前端 未结 1 986
别那么骄傲
别那么骄傲 2020-11-27 07:03

Changing the upper limits for scale_fill_gradient2 also effects the colorscaling for values < 0 as the color distribution around 0 seems to be always symmetr

相关标签:
1条回答
  • 2020-11-27 07:44

    What you want is scale_fill_gradientn. The arguments are not very clear (took me an hour or so to finally figure part of it out), though:

    library("scales")
    p + scale_fill_gradientn(colours = c("blue","white","red"), 
                             values = rescale(c(-.1,0,.3)),
                             guide = "colorbar", limits=c(-.1,.3))
    

    Which gives:

    enter image description here

    0 讨论(0)
提交回复
热议问题