1 / 56
文档名称:

R语言入门 图形.ppt

格式:ppt   页数:56页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

R语言入门 图形.ppt

上传人:825790901 2016/1/3 文件大小:0 KB

下载得到文件列表

R语言入门 图形.ppt

文档介绍

文档介绍:实验目的实验内容学****如何应用R软件解决绘图问题1、绘图方法2、应用实例3、实验作业第六讲图形常用图形?S-PLUS有很强的图形功能,它可以用简单的函数调用迅速作出数据的各种图形,当你熟悉了S图形的技术之后也可以指定许多图形选项按自己的要求定制图形。它的另一个特色是同一个绘图函数对不同的数据对象可以作出不同的图形。例如,读入cl数据框:?c1=("E://", header = TRUE, sep = "") names(cl); attach(cl);plot(Height)或> plot(cl$Height)绘制身高的散点图(纵轴为身高值,横轴为下标)。?最常用的绘图函数为plot(),用plot()作两个变量x与y的散点图,使用如下例的方法:?> plot(Height, Weight, main="体重对身高的回归", + xlab="身高", ylab="体重") ?为了绘制连线图,只要在plot()函数中加type=“l”选项,> plot((1:50)/50, log((1:50)/50), type="l") ?可以绘制变量的茎叶图,Usage: stem(x, scale = 1, width = 80, atom = 1e-08)Arguments: x: a numeric vector. scale: This controls the plot length. width: The desired width of plot. atom: a :Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S Language_. Wadsworth & Brooks/: stem(islands) stem(log10(islands))>stem(cl$Weight, scale = 1, width = 80, atom = 1e-08)The decimal point is 1 digit(s) to the right of the | 4 | 1 6 | 7 8 | 3445508 10 | 0332233 12 | 83 14 | 0>sort(Weight) [1] [13] >stem(cl$Weight, scale = 2, width = 80, atom = 1e-08)The decimal point is 1 digit(s) to the right of the | 5 | 1 6 | 7 | 7 8 | 34455 9 | 08 10 | 033 11 | 2233 12 | 8 13 | 3>sort(Weight) [1] [13] ,如:> boxplot(cl$Weight) 可以绘制几个变量并排的盒形图,> boxplot(cl$Height~cl$Sex,data=cl)