下面密度图添加盒形图

问题描述 投票:5回答:2

我是新来ggplot我试图创建此图:

enter image description here

但实际上,我只是被困在这里:

enter image description here

这是我的代码:

ggplot(diamonds)  + 
  aes(x = carat, group = cut) + 
  geom_line(stat = "density", size = 1) + 
  theme_grey() + 
  facet_wrap(~cut, nrow = 5, strip.position = "right") + 
  geom_boxplot(aes())

是否有人知道我能接下来怎么办?

r ggplot2
2个回答
© www.soinside.com 2019 - 2024. All rights reserved.