服务热线
178 0020 3020
任务一:
Install.packages(“Rmisc”)
library(ggplot2)
library(Rmisc)
mytheme=theme_classic()+theme(legend.justification=c(1,0),legend.position = c(1,0),panel.grid.major = element_blank(), panel.grid.minor = element_blank(),axis.line.x=element_line(colour = "black"),axis.line.y=element_line(colour = "grey"),legend.background=element_blank())
tg=ToothGrowth
head(tg)
tgc=summarySE(tg,measurevar="len",groupvars=c("supp","dose"))
tgc
p=ggplot(tgc,aes(x=dose,y=len,color=supp,group=supp,shape=supp))+geom_line()
p
m=p+geom_errorbar(aes(ymin=len-se,ymax=len+se),width=.1)+geom_point(size=3)
m
n=m+mytheme+labs(title="R2-22")
n
任务2:
library(ggplot2)
options=(scipen=999)
mytheme=theme_bw()
data(midwest)
data
a=ggplot(midwest,aes(x=area,y=poptotal))+geom_point(aes(col=state,size=popdensity))+geom_smooth(method = "loess",se=F)+xlim(c(0,0.1))+ylim(c(0,500000))
a
p=a+labs(substitle="Area Vs Population",y="Population",x="Area",title="R2-22",caption="Source:midwest")+mytheme
p
任务三:
library(ggplot2)
data=read.csv(file.choose(),header = TRUE)
data
data=data[order(data$PTS),]
row.names(data)=data$Name
data=data[,-c(2:50)]
data1=data.matrix(data)
data1
P=heatmap(data1,Rowv=NA,Colv=NA,scale="column")
附件