R ggplot框打印镶嵌面

R ggplot框打印镶嵌面,r,ggplot2,boxplot,facet-wrap,R,Ggplot2,Boxplot,Facet Wrap,我正在使用以下代码制作ggplot方框图: p <- ggplot(data = five, mapping = aes(x = variable, y = value, fill = variable)) + geom_boxplot(alpha = .3) + geom_jitter(alpha = .3) + labs(title = "Stock Data", x = "Index", y =

我正在使用以下代码制作ggplot方框图:

     p <- ggplot(data = five, mapping = aes(x = variable, y = value, fill = variable)) +
      geom_boxplot(alpha = .3) + 
      geom_jitter(alpha = .3) + 
      labs(title = "Stock Data", x = "Index", y = "Percent Return") + 
      theme_bw() +
      theme(plot.title = element_text(hjust = 0.5)) +
      facet_wrap(vars(variable))
     p 
pscales=“free”需要添加到facet\u wrap参数中

p <- ggplot(data = five, mapping = aes(x = variable, y = value, fill = variable)) +
      geom_boxplot(alpha = .3) + 
      geom_jitter(alpha = .3) + 
      labs(title = "Stock Data", x = "Index", y = "Percent Return") + 
      theme_bw() +
      theme(plot.title = element_text(hjust = 0.5)) +
      facet_wrap(vars(variable), scales = "free")
    
    p 

p
变量
以x轴、颜色和面进行编码。您可以将其完全从x轴移除。