赞
踩
attach(iris)
boxplot(sepal.Length~Specis,col=heat.colors(3),
axes=FALSE,xlab=“species”,ylab = “sepal.Length”)
attach(longley)
boxplot(decrease~treatment,col=heat.colors(3),
main=list(“影响”,font=4,col=“grey”,cex=1.5),
sub=list(“数据来源:longley 数据集”,font=3,
col=“black”,cex=0.8),
xlab=“treatment”,ylab=“decrease”)
set.seed(1234)
data <- c(rnorm(100,mean=0,sd=1),rnorm(3,mean=2,sd=1))
str(data)
head(data)
length(data)
str(data)
str(data)
summary(data)
boxplot(data.col=“violet”,ylim=c(-4,5),outoline=F)
points(rep(1,3),data(31:34),pch=24,bg=c(“blue”,“grey”,“red”),cex=1.2)
data[31:34]
#利用ggplot函数绘制箱线图:
library(ggplot2)
ggplot(iris,aes(x=Species,y=Sepal.Length,fill=Species))+
goem_boxplot()+
labs(title=”依据种类分组的花萼长度箱线图”)
#绘制散点图
library(dplyr)
if(!require(rboken)) install.packages(“rboken”)
z<-lm(dist ·speed ,data=cars)
p<-figure(width =600,height =600) %>%
ly_points(cars,hover=cars)5》%>%
ly_lines(lowess(cars),legend =“lowess”) %>%
ly_abline(z,type =2,lengend =“lm”)
#绘制直方图
h < -figure(width =600,height =400) %>%
ly_hist(eruptions,data=faithful,breaks =40,freq =FALSE)%>%
ly_density(eruptions,data=faithhful)
#绘制箱线图
figure(ylab=“Height(inches)”,width =600)%>%
ly_boxplot(voice.part,height,data =lattice::singer)