服务热线
178 0020 3020
Task1
library(ggplot2)
df2 <- data.frame(supp=rep(c("VC", "OJ"), each=3),
D=rep(c("D0.5", "D1", "D2"),2),
L=c(6.8, 15, 33, 4.2, 10, 29.5))
head(df2)
p<-ggplot(df2, aes(x=D, y=L, group=supp)) +
geom_line(aes(color=supp))+
geom_point(aes(color=supp))+ggtitle("R2-24")
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-24",
caption = "Source: midwest")
plot(gg)
setwd("D:/R-LMT/10/10")
library(reshape2)
library(ggplot2)
library(plyr)
library(scales)
data_heatmap<- read.csv("task3.csv")
data_m <- melt(data_heatmap, id.vars=c("Name"))
data_m <- ddply(data_m, .(variable), transform, label = rescale(value))
ggplot(data_m, aes(x=variable,y=Name)) +
geom_tile(aes(fill=label)) +
scale_fill_gradient(low = "yellow", high = "red") +
xlab("Type") + theme_bw() + ggtitle("R2-24")
附件