如何在没有其他库的情况下将 2 个箱线图放在 R 中的一个图中?
How to put 2 boxplot in one graph in R without additional libraries?
我有这种数据集
Defect.found Treatment Program
1 Testing Counter
1 Testing Correlation
0 Inspection Counter
3 Testing Correlation
2 Inspection Counter
我想创建两个箱线图,一个是每个程序检测到的缺陷的箱线图,另一个是每个技术检测到的缺陷的箱线图,但在一张图中。
意思是:
boxplot(exp$Defect.found ~ exp$Treatment)
boxplot(exp$Defect.found ~ exp$Program)
在连接图中。
在 Whosebug 上搜索我能够创建它,但使用 lattice 库输入:
bwplot(exp$Treatment + exp$Program ~ exp$Defects.detected)
但我想知道是否可以在没有其他库(如 ggplot
和 lattice
的情况下创建图形
准备绘图window接收一行两列的两个绘图(默认显然是一行一列):
par(mfrow = c(1, 2))
我的建议是避免使用 exp
这个词,因为它已经用于指数函数。例如使用 mydata
。
发现缺陷反对处理(frame = F
压制外框):
with(mydata, plot(Defect.found ~ Treatment, frame = F))
针对程序发现的缺陷(ylab = NA
抑制了 y 标签,因为它已在上一个图中显示):
with(mydata, plot(Defect.found ~ Program, frame = F, ylab = NA))
我有这种数据集
Defect.found Treatment Program
1 Testing Counter
1 Testing Correlation
0 Inspection Counter
3 Testing Correlation
2 Inspection Counter
我想创建两个箱线图,一个是每个程序检测到的缺陷的箱线图,另一个是每个技术检测到的缺陷的箱线图,但在一张图中。
意思是:
boxplot(exp$Defect.found ~ exp$Treatment)
boxplot(exp$Defect.found ~ exp$Program)
在连接图中。
在 Whosebug 上搜索我能够创建它,但使用 lattice 库输入:
bwplot(exp$Treatment + exp$Program ~ exp$Defects.detected)
但我想知道是否可以在没有其他库(如 ggplot
和 lattice
准备绘图window接收一行两列的两个绘图(默认显然是一行一列):
par(mfrow = c(1, 2))
我的建议是避免使用 exp
这个词,因为它已经用于指数函数。例如使用 mydata
。
发现缺陷反对处理(frame = F
压制外框):
with(mydata, plot(Defect.found ~ Treatment, frame = F))
针对程序发现的缺陷(ylab = NA
抑制了 y 标签,因为它已在上一个图中显示):
with(mydata, plot(Defect.found ~ Program, frame = F, ylab = NA))