Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
facet_wrap()和#x2B中每个面的独立颜色渐变;ggplot2()_R_Ggplot2_Colors_Gradient_Facet Wrap - Fatal编程技术网

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
是不容易的