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.

142 第六章 系统<br />

8 > plot(0:1, 0:1)<br />

9 > rect(0, 0, 1, 1, col = "red")<br />

10 > # 为了改变颜色,重画整幅图形<br />

11 > plot(0:1, 0:1)<br />

12 > rect(0, 0, 1, 1, col = "blue")<br />

13 > # 当然,这里可以用新的矩形覆盖旧的,但旧矩形仍然存在<br />

6.2 lattice图形<br />

lattice(Sarkar, 2010)是基于grid包的一套统计图形系统,它的图形设<br />

计理念来自于Cleveland (1993)的Trellis图形 1 ,其主要特征是根据特定变量<br />

(往往是分类变量)将数据分解为若干子集,并对每个子集画图。就像数理<br />

统计中的条件期望、条件概率一样,lattice的图形也是一种“条件作图”。<br />

6.3 ggplot2图形<br />

上一节中lattice虽然灵活,但它无穷无尽的选项往往让用户感到迷<br />

茫。ggplot2(Wickham, 2009)从易用性出发,结合了基础图形系统的简便以<br />

及grid和lattice的灵活,并以“The Grammar of Graphics”一书(Wilkinson,<br />

2005)的理论为支撑,构建了一套实用而且美观的图形系统。<br />

1 http://cm.bell-labs.com/cm/ms/departments/sia/project/trellis/

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

Saved successfully!

Ooh no, something went wrong!