如何将箱线图并排放置? [英] How to place boxplot side by side?

查看:146
本文介绍了如何将箱线图并排放置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我数据的一部分:

我想并排放置"Maintain.Diverse..Functional","Maintain.Focal.Rare"和"Restore.Habitat.Structure"的箱形图.我试过了:

I would like to place box plots of "Maintain.Diverse..Functional", "Maintain.Focal.Rare", and "Restore.Habitat.Structure" side by side. I tried this:

boxplot(A$Maintain.Diverse..Functional, ylab="ranking", xlab="Maintain.Diverse..Functional")

但是我只能得到一个箱形图,我想知道如何以相同的比例并排添加另外两个箱形图?!

But I only get one box plot, I was wondering how to add two other boxplots side by side with the same scale?!

数据

structure(list(Maintain.Diverse..Functional = c(1, 1, 1, 2, 1, 
4, 4, 1, 4, 4, 7, 3, 6), Maintain.Focal.Rare = c(2, 3, 3, 4, 
2, 3, 1, 2, 1, 3, 2, 1, 1), Restore.Habitat.Structure = c(3, 
5, 2, 3, 3, 1, 2, 3, 2, 2, 6, NA, 3)), .Names = c("Maintain.Diverse..Functional", 
"Maintain.Focal.Rare", "Restore.Habitat.Structure"), row.names = c(NA, 
-13L), class = "data.frame")

推荐答案

当我输入以下内容时,它会起作用:

It works when I typed this:

boxplot(yourdata[c("Maintain.Diverse..Functional", "Maintain.Focal.Rare", "Restore.Habitat.Structure" )])

谢谢@ user20650的回答!

Thank you @user20650 for your answer!

这篇关于如何将箱线图并排放置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆