facet_wrap()和#x2B中每个面的独立颜色渐变;ggplot2()
我正在努力独立地为facet_wrap()和#x2B中每个面的独立颜色渐变;ggplot2(),r,ggplot2,colors,gradient,facet-wrap,R,Ggplot2,Colors,Gradient,Facet Wrap,我正在努力独立地为facet\u 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') + t
facet\u 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')
)
但是,如果我单独绘制一个作者,我会得到:
我只想用它自己的渐变色阶绘制每个面,而不是和其他面共享。应该很简单,但我没能做到。我尝试在
geom_tile()
和ggplot()
中的aes()
中添加group=author
,但没有效果。经过大量研究,我最终使用了使用gridExtra
提供的解决方案。我想仅仅使用ggplot
是不容易的