-1

我一直在使用以下代码。但是,x 轴不是从 -5000 开始,而是从 0 开始。另外,我想为 x 轴和 y 轴范围指定 100 的间隔。我尝试使用xaxt='n'and axis(side=1),但这没有帮助。以下代码是我目前正在处理的代码

setwd("/path/")
data<-read.table("input.txt",sep="\t",header=F)
x<-data$V4
h<-hist(x, col="green",xlim=c(-5000, 162000),ylim=c(0,0.0003),main="TPMDistribution",xlab="TPMValues",probability=TRUE)
s=sd(x)
m=mean(x)
curve(dnorm(x,mean=m,sd=s),add=TRUE,lwd=3,col="red")
lines(density(x),col="blue")
abline(v=mean(x),col="blue")
mtext(paste("mean",round(mean(x),1),";sd",round(sd(x),1),";N",length(x),sep=""),side=1,cex=.75)
dev.off()

所有帮助表示赞赏。提前致谢。

4

1 回答 1

0

您可能需要在数组中指定中断,请参见此处: http ://stat.ethz.ch/R-manual/R-patched/library/graphics/html/hist.html

并使用以下方式调整轴:http: //stat.ethz.ch/R-manual/R-patched/library/graphics/html/axis.html

您可能需要在 hist() 中使用 axes=FALSE,因此您可以在后续行中将它们替换为 axis()。

于 2012-06-18T15:58:37.563 回答