02.07.2013 Views

现代统计图形 - 科学网—博客

现代统计图形 - 科学网—博客

现代统计图形 - 科学网—博客

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

104 第五章 图库<br />

1 > panel.hist = function(x, ...) {<br />

2 + usr = par("usr")<br />

3 + on.exit(par(usr))<br />

4 + par(usr = c(usr[1:2], 0, 1.5))<br />

5 + h = hist(x, plot = FALSE)<br />

6 + nB = length(breaks idx = as.integer(iris[["Species"]])<br />

11 > pairs(iris[1:4], upper.panel = function(x, y, ...) points(x,<br />

12 + y, pch = c(17, 16, 6)[idx], col = idx), pch = 20,<br />

13 + oma = c(2, 2, 2, 2), lower.panel = panel.smooth,<br />

14 + diag.panel = panel.hist)<br />

2.0 3.0 4.0<br />

0.5 1.5 2.5<br />

Sepal.Length<br />

4.5 5.5 6.5 7.5<br />

2.0 2.5 3.0 3.5 4.0 0.5 1.0 1.5 2.0 2.5<br />

Sepal.Width<br />

Petal.Length<br />

1 2 3 4 5 6 7<br />

Petal.Width<br />

图 5.23: 鸢尾花数据的散点图矩阵:上三角区域为不同样式的点,对应着不<br />

同种类的鸢尾花,对角线的直方图展示了花瓣花萼长宽的一维分布,下三<br />

角区域用平滑曲线显示了变量之间的关系。<br />

4.5 5.5 6.5 7.5<br />

1 2 3 4 5 6 7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!