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.

4.3 曲线、直线、线段、箭头、X-样条 47<br />

1 > # 不作图,只画出框架,且指定坐标轴范围<br />

2 > plot(1:10, type = "n", xlim = c(0, 10), ylim = c(0,<br />

3 + 10))<br />

4 > # 10个正态随机数绝对值的波动线<br />

5 > lines(1:10, abs(rnorm(10)))<br />

6 > # 不同的直线<br />

7 > abline(a = 0, b = 1, col = "gray")<br />

8 > abline(v = 2, lty = 2)<br />

9 > abline(h = 2, lty = 2)<br />

10 > #添加文本<br />

11 > text(8, 3, "abline(a = 0, b = 1)")<br />

12 > # 添加箭头<br />

13 > arrows(8, 3.5, 6, 5.7, angle = 40)<br />

14 > # 参数用了向量:不同灰度的线段<br />

15 > segments(rep(3, 4), 6:9, rep(5, 4), 6:9, col = gray(seq(0.2,<br />

16 + 0.8, length = 4)))<br />

17 > text(4, 9.8, "segments")<br />

1:10<br />

0 2 4 6 8 10<br />

segments<br />

0 2 4 6 8 10<br />

Index<br />

abline(a = 0, b = 1)<br />

图 4.5: 曲线、直线、直线段、箭头的展示说明

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

Saved successfully!

Ooh no, something went wrong!