服务热线
178 0020 3020
task1:
df2 <- data.frame(supp=rep(c("VC", "OJ"), each=3),
dose=rep(c("D0.5", "D1", "D2"),2),
len=c(6.8, 15, 33, 4.2, 10, 29.5))
head(df2)
p<-ggplot(df2, aes(x=dose, y=len, group=supp)) +
geom_line(aes(color=supp))+
geom_point(aes(color=supp))+ggtitle("R2-31")
p+scale_color_grey()+theme_classic()task2:
options(scipen=999)
library(ggplot2)
theme_set(theme_bw())
data("midwest", package = "ggplot2")
gg <- 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-31",
caption = "Source: midwest")
plot(gg)task3:
install.packages("RColorBrewer")
library(RColorBrewer)
nba <- read.csv(file.choose())
nba <- nba[order(nba$PTS),]
row.names(nba) <- nba$Name
nba <- nba[,2:20]
nba_matrix <- data.matrix(nba)
nba_heatmap <- heatmap(nba_matrix, Rowv=NA, Colv=NA, col = brewer.pal(9, "Blues"),
scale="column", margins=c(5,10), main="R2-31")


附件