R语言如何绘制类似于箱线图的散点图
发表于:2024-09-26 作者:千家信息网编辑
千家信息网最后更新 2024年09月26日,这篇文章主要为大家展示了"R语言如何绘制类似于箱线图的散点图",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"R语言如何绘制类似于箱线图的散点图"这篇文章吧。
千家信息网最后更新 2024年09月26日R语言如何绘制类似于箱线图的散点图
这篇文章主要为大家展示了"R语言如何绘制类似于箱线图的散点图",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"R语言如何绘制类似于箱线图的散点图"这篇文章吧。
作图需要整备两个文件,即各差异组合差异基因的差异倍数,如下所示:
log2FC Group-0.003569046 SR58-1-0.033401692 SR58-1-0.00595792 SR58-1-0.126160677 SR58-1-0.003569046 SR58-10.062951504 SR58-1-0.085369416 SR58-10.061838866 SR58-1-0.006699121 SR58-1-0.006699121 SR58-10.565357698 SR58-1-1.478225114 SR58-1-0.081035817 SR58-1-0.103533775 SR58-1-0.143437623 SR58-1-0.103533775 SR58-1-0.143437623 SR58-1-0.095751056 SR58-10.358148301 SR58-1-0.187767352 SR58-10.389438905 SR58-1
绘图用的是R脚本,代码为:
library(ggplot2)library('getopt');spec = matrix(c('help' , 'h', 0, "logical","for help",'input1' , 'i', 1, "character","input the abuance of tax in each sample ,required",'input2' , 's', 1, "character","input the abuance of tax in each sample ,required",#'row' , 'r' , 1 , "character","row name,required",'name' , 'n', 1, "character","photo name"), byrow=TRUE, ncol=5);opt = getopt(spec);print_usage <- function(spec=NULL){cat(getopt(spec, usage=TRUE));q(status=1);}if ( !is.null(opt$help) ) { print_usage(spec) }if ( is.null(opt$input1) ){ print_usage(spec) }if ( is.null(opt$input2) ){ print_usage(spec) }if ( is.null(opt$name) ){ opt$name = "Co-occurrence_network" }#读入数据point1 <- read.table(opt$input1,sep="\t",header = TRUE,comment.char = "")point2 <- read.table(opt$input2,sep="\t",header = TRUE,comment.char = "")#分别取中位数median1 = median(point1$log2FC, na.rm = FALSE)median2 = median(point2$log2FC, na.rm = FALSE)print(median1)print(median2)#行合并point = rbind(point1,point2)p <- ggplot(point, aes(x=Group, y=log2FC)) + geom_point(size=0.5)+geom_segment(aes(x=0.95,y=median1,xend=1.05,yend=median1))+geom_segment(aes(x=1.95,y=median2,xend=2.05,yend=median2))+geom_hline(aes(yintercept=0), colour="#000000", linetype="dashed")+theme(######取消默认的背景颜色方框等panel.background = element_rect(fill = "transparent",colour = "black"), panel.grid.minor = element_blank(), panel.grid.major = element_blank(),plot.background = element_rect(fill = "transparent",colour = "black"))#输出文件名称png_name=paste(opt$name, ".png", sep="")pdf_name=paste(opt$name, ".pdf", sep="")#输出pdf格式图片pdf(pdf_name,width =3,height = 3)print(p)dev.off()#输出png格式图片png(png_name,width =2000,height =2000,res = 500,units = "px")print(p)dev.off()
以上是"R语言如何绘制类似于箱线图的散点图"这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!
线图
语言
内容
差异
篇文章
输出
图片
文件
格式
学习
帮助
两个
中位数
代码
倍数
名称
基因
数据
方框
易懂
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
软件开发培训评价
卡桑数据库
阿里云数据库不能访问吗
关于数据库命名的规则
物流管理与网络技术
开发手机与软件开发有什么关系
服务器管理软件排名
英东势起互联网科技
免费学习数据库视频
4g时代网络技术论文
数据库字符集设置
关于什么是数据库
年服务器
网络安全存在的安全
金融科技应用与互联网专业一样吗
婺城区软件开发教程
软件开发一年制
网络安全的攻击方式
国家农作物种质资源数据库
什么叫网络技术专业
临沂达尼亚网络技术
拳头游戏玩不同服务器还要注册吗
2019网络安全攻防
无人驾驶的通信和网络技术
国家网络技术试题及解析
怎么用云服务器
西青金蝶软件开发怎么选
模拟微信服务器
国产数据库管理技术的发展
泉州速腾网络技术有限公司