解决R绘图时报错X11

来源:互联网 发布:win10 无网络访问权限 编辑:程序博客网 时间:2024/05/18 01:29

报错代码

data=read.table('scaffold_len&depth&GC.txt',header = T,sep = '\t')png('test.png')with(data,smoothScatter(GC_rate*100,Depth,ylim = c(0,200),xlab = 'GC%',ylab = 'Seq dep(X)'))dev.off()

报错内容

Error in png("GC_depth_R.png") : X11 is not availableExecution halted

解决方案一

data=read.table('scaffold_len&depth&GC.txt',header = T,sep = '\t')bitmap('test.png',"png16m")with(data,smoothScatter(GC_rate*100,Depth,ylim = c(0,200),xlab = 'GC%',ylab = 'Seq dep(X)'))dev.off()

解决方案二

生成PDF文件即可

data=read.table('scaffold_len&depth&GC.txt',header = T,sep = '\t')pdf('test.pdf')with(data,smoothScatter(GC_rate*100,Depth,ylim = c(0,200),xlab = 'GC%',ylab = 'Seq dep(X)'))dev.off()
原创粉丝点击