小编F. *_*ans的帖子

图例颜色栏被截断,并且使用连续比例限制不受限制

我有时有问题与使用连续当图例不显示颜色的整个范围fillcolor尺度,例如scale_fill_continuous,scale_fill_gradient,scale_fill_gradientn(和相应的color尺度).

特别是colorbar图例的上限范围被截断,即它不会一直延伸到调色板的上限.此外,图例的标题垂直调整为(截断的)colorbar,而不是上限.

一个小例子:

# set up data, base plot, limits, labels and breaks
# adjust theme for legend just to make the issue more visible

df <- data.frame(x = 1:4, y = 1, col = c(0.1, 0.3, 0.5, 0.7))

library(ggplot2)
p <- ggplot(data = df, aes(x, y, fill = col)) +
  geom_point(size = 15, shape = 21) +
  theme_minimal() +
  theme(legend.background = element_rect(fill = …
Run Code Online (Sandbox Code Playgroud)

r colors ggplot2

7
推荐指数
1
解决办法
798
查看次数

标签 统计

colors ×1

ggplot2 ×1

r ×1