小编BKV*_*BKV的帖子

具有共同图例的 ggarrange 在降价中产生额外的空白图

我正在使用 R Notebooks 并且有一个包含一些用于排列直方图的代码的块。当我使用一个普通的图例时,它会产生一个额外的空图,在渲染的 html 文件中看起来很糟糕。这种现象在没有共享图例的情况下消失了,但由于它们的大小不同,因此情节看起来很糟糕。有什么办法可以阻止它产生额外的空图?

笔记本块输出

和块中使用的代码

 ```{r}

ggarrange(

gghistogram(data, title="MOTIVATION SCORES", x="MOTIVATION", y="..density..", 
add_density=TRUE, add = "median", rug = TRUE, bins=15, color="#69c8ECFF", 
fill="#69c8ECFF") , 


gghistogram(data, title="MOTIVATION BY AGE GROUP", x = "MOTIVATION", 
y="..density..", add_density=TRUE,
          add = "median", rug = TRUE, bins=15,
          color = "AGE_GROUP", fill = "AGE_GROUP",
          palette = c("#69c8ECFF", "#E762D7FF")
          )

, legend = "bottom" 
, common.legend = TRUE

)
```
Run Code Online (Sandbox Code Playgroud)

r ggplot2 r-markdown rnotebook ggpubr

5
推荐指数
1
解决办法
1479
查看次数

标签 统计

ggplot2 ×1

ggpubr ×1

r ×1

r-markdown ×1

rnotebook ×1