我正在努力为 facet_wrap()
中的每个方面绘制渐变色标独立。
数据太大,无法在此处发布,但这是我的代码:
ggplot(stack, aes(hour, day)) +
geom_tile(aes(fill = percent), colour = "white") +
facet_wrap(~author, ncol = 3) +
theme_minimal() +
scale_fill_distiller(palette = 'RdYlBu') +
theme(
axis.title.x = element_blank(), axis.title.y = element_blank(),
legend.position = "none",
strip.background = element_rect(fill = '#E5E6E1'),
strip.text = element_text(face = 'bold')
)
但是,如果我只单独绘制一位作者,我会得到:
我只想用自己的渐变色标绘制每个方面,而不是与其他方面共享。应该很简单,但我没能做到。我尝试添加
group = author
内aes()
在 geom_tile()
和 ggplot()
但它不起作用。
最佳答案
经过大量研究,我最终使用了提供的解决方案 here使用 gridExtra
.我想没有简单的方法可以只使用 ggplot
.
关于r - facet_wrap() + ggplot2() 中每个面的独立颜色渐变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59108493/