相关疑难解决方法(0)

scale_gradient2中的不对称颜色分布?

更改上限scale_fill_gradient2也会影响值<0的颜色分类,因为0周围的颜色分布似乎总是对称的,是否有办法获得颜色值的不对称分布?

这是一个使用的情节的最小例子geom_tile():

data <- read.csv("http://protzkeule.de/data.csv")
p <- ggplot(data = data, aes(x = variable, y = meas)) + geom_tile(aes(fill = value))
Run Code Online (Sandbox Code Playgroud)

具有对称限制的图:

p + scale_fill_gradient2(low = "blue", mid = "white", high = "red", guide = "colorbar",
                         limits = c(-0.1, 0.1))
Run Code Online (Sandbox Code Playgroud)

但是当更改上限时,较低的颜色映射也会改变(观察颜色条):

p + scale_fill_gradient2(low = "blue", mid = "white", high = "red", guide = "colorbar",
                         limits = c(-0.1, 0.3))
Run Code Online (Sandbox Code Playgroud)

r colors scale ggplot2

18
推荐指数
1
解决办法
4845
查看次数

标签 统计

colors ×1

ggplot2 ×1

r ×1

scale ×1