我正在努力为每个方面绘制渐变色标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
within aes()
in geom_tile()
and ggplot()
但这是行不通的。
经过大量研究,我最终使用了提供的解决方案here https://stackoverflow.com/questions/33139247/ggplot2-save-individual-facet-wrap-facets-as-separate-plot-objects使用gridExtra
。我想没有简单的方法可以仅使用ggplot
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)