服务热线
178 0020 3020
task1
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 = "black "),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-27")
n
task2
options(scipen = 999)
theme_set(theme_bw())
p2<-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))+labs(subtitle="Area Vs Population",
y="Population",
x="Area",
title="R2-27",
caption="Source:midwet")
p2
task3
library(pheatmap)
library(gplots)
library(ggplot2)
mydata<-read.csv("D:\\task3.csv",head=TRUE)
library(reshape2)
mydata<-mydata[order(mydata$PTS),]
row.names(mydata)<-mydata$Name
mydata<-mydata[,2:20]
mydata_matrix<-data.matrix(mydata)
plot_mydata<-heatmap(mydata_matrix, Rowv=NA, Colv=NA, col=heat.colors(256), revC=FALSE, scale="column", margins=c(5,10))
附件