数据练习画图
attach (beaver1)
par(mfrow=c (2,2))
hist(beaver1,8,xlab=“海狸每10分钟的体温数据”, ylab=“频数”, col=“blue”,
main=“海狸每10分钟的体温数据”)
detach(beaver1)
str(quakes)
head(quakes)
attach (quakes)
boxplot(long~depth,col=heat.colors(3),
main=list (“箱线图”,font=4 ,col=“red” , cex=1.5),
sub=list(“数据来源:attitude数据集”, font=3,col=“green” , cex=0.8),
zlab=“long” ,ylab=“depth”)
attach (beaver1)
boxplot(conc~state,col=heat.colors(3),
main=list ( “箱线图”,font=4 ,col=“red” , cex=1.5),
sub=list(“数据来源:beaver1数据集”, font=3,col=“green” , cex=0.8),
zlab=“species” ,ylab=“sepal.Length”)
#柱状图
head(beaver1)
class(beaver1)
beaver1 <-as.matrix(beaver1)
barplot(beaver1,beside=TRUE, col=cm.colors(4))