R2-10-第一期-ggplot2画散点图/折线图作业

superhong 2017-11-01 20:57:20 阅读: 1096

work.dir <- "F:/R Learning/exercise/R2-01-1/"

setwd(work.dir)

getwd()  #check working directory

data1 <- read.csv("R2-1-1.csv",sep=',', header=TRUE)

data2 <- read.table("R2-1-2.csv",sep=',', header=TRUE)

library(ggplot2)



p <- ggplot(data1, aes(x=A, y=B,colour=SIZE))  

p <- p + geom_point(size=2, shape=1)

p <- p + xlim(-2,3)+ylim(-1,3)

p <- p + labs(title = "R2-10")

p <- p + labs(x = "A gene expression", y = "B gene expression")

p


p <- ggplot(data1, aes(x=A, y=B,colour=SIZE))  

p <- p + geom_point(size=2, shape=19)

p <- p + xlim(-2,3)+ylim(-1,3)

p <- p + labs(title = "R2-10")

p <- p + labs(x = "A gene expression", y = "B gene expression")

p


p <- ggplot(data1, aes(x=A, y=B,colour=SIZE))  

p <- p + geom_point(size=2, shape=20)

p <- p + xlim(-2,3)+ylim(-1,3)

p <- p + labs(title = "R2-10")

p <- p + labs(x = "A gene expression", y = "B gene expression")

p


p <- ggplot(data1, aes(x=A, y=B,colour=SIZE))  

p <- p + geom_point(size=2, shape=21)

p <- p + xlim(-2,3)+ylim(-1,3)

p <- p + labs(title = "R2-10")

p <- p + labs(x = "A gene expression", y = "B gene expression")

p


#exercise 2

p <- ggplot(data2, aes(x=Time, y=value)) 

p <- p +geom_point(aes(shape = SIZE,colour=SIZE), size=2)

p <- p + geom_line(aes(group=SIZE))

p <- p + labs(title = "R2-10")

p

R2-10_1_1-1.png


R2-10_1_1-2.png

R2-10_1_1-3.png

R2-10_1_1-4.png

R2-10_1_2.png


 
邀请讨论

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
{{item.nick_name}} 受邀请回答 {{item.create_time}}
{{item.refer_comment.nick_name}} {{item.refer_comment.create_time}}

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
切换到完整回复 发送回复
赞({{item.count_zan}}) 踩({{item.count_cai}}) 删除 回复 关闭
科研狗©2015-2024 科研好助手,京ICP备20005780号-1 建议意见

服务热线

178 0020 3020

微信服务号