现代统计图形 - 科学网—博客
现代统计图形 - 科学网—博客
现代统计图形 - 科学网—博客
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
5.27 饼图 127<br />
1 > # 拆分作图区域<br />
2 > layout(matrix(c(1, 2, 1, 3), 2))<br />
3 > pie.sales = c(0.12, 0.3, 0.26, 0.16, 0.04, 0.12)<br />
4 > names(pie.sales) = c("Blueberry", "Cherry", "Apple",<br />
5 + "Boston Cream", "Other", "Vanilla Cream")<br />
6 > pie.col = c("purple", "violetred1", "green3", "cornsilk",<br />
7 + "cyan", "white")<br />
8 > # 饼图、点图和条形图<br />
9 > pie(pie.sales, col = pie.col)<br />
10 > dotchart(pie.sales, xlim = c(0, 0.3))<br />
11 > barplot(pie.sales, col = pie.col, horiz = TRUE, names.arg = "",<br />
12 + space = 0.5)<br />
Vanilla Cream<br />
Other<br />
Boston Cream<br />
Apple<br />
Cherry<br />
Blueberry<br />
Apple<br />
Cherry<br />
Other<br />
Boston Cream<br />
Blueberry<br />
Vanilla Cream<br />
0.00 0.10 0.20 0.30 0.00 0.05 0.10 0.15 0.20 0.25 0.30<br />
图 5.35: 各类馅饼销售数据的饼图:对比上面的饼图和下面的点图以及条形<br />
图,人眼对角度或比例的感知能力是否弱于对长度的感知能力?