箱线图
箱线图使用boxplot函数。boxplot中参数x为公式。R中的公式如何定义呢?最简单的 y ~ x 就是y是x的一次函数。下表就是相关的符号代表的意思:
符号 | 示例 | 意义 |
+ | +x | 包括该变量 |
– | -x | 不包括该变量 |
: | x:z | 包括两变量的相互关系 |
* | x*z | 包括两变量,以及它们之间的相互关系 |
/ | x/z | nesting: include z nested within x |
| | x|z | 条件或分组:包括指定z的x |
1 | -1 | 截距:减去该截距 |
> op <- par(mfrow = c(1, 2))
> boxplot(mpg ~ cyl, data = mtcars, main = "Car Milage Data", xlab = "Number of Cylinders",
+ ylab = "Miles Per Gallon")
> boxplot(len ~ supp * dose, data = ToothGrowth, notch = TRUE, col = (c("gold",
+ "darkgreen")), main = "Tooth Growth", xlab = "Suppliment and Dose")
> par(op)
您好!
我在绘制箱式图时boxplot(Pset, col = cols, ylim = c(0.95,1.22), main = “NUSE”,las = 2),图中细胞名称如MDB-MB-231,会自动变成MDA.MB.231。这该怎么调整?
非常感谢!
boxplot(Pset, col = cols, ylim = c(0.95,1.22), main = “NUSE”, las = 2, names=c(…, “MDB-MB-231”, …))。中间的…要换成MDB-MB-231前后的相应的名称。