当前位置:   article > 正文

2020-09-21

2020-09-21

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)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/131938
推荐阅读