plot散点图使用科学记数法展示p value

> pvalue<-c(0.1,0.001,0.003,0.005,0.00006)
> plot(pvalue,ylim = c(1,10^-6), xlim = c(0,5))
plot散点图使用科学记数法展示p value_第1张图片

图做出来了,但是貌似什么问题都说明不了;那换用科学记数法的方式看看。

> plot(a, log = "y",ylim = c(1,10^-6), xlim = c(0,5))
plot散点图使用科学记数法展示p value_第2张图片

这样子看起来就好多了,但将纵坐标e换成10是不是更漂亮一点。
完成这一步,可以使用emdbook包中axis.scinot()函数。

>install.packages("emdbook")
>library("emdbook")

scinot

scinot: Scientific notation as LaTeX/expression()
Description
Takes a number and returns a version formatted in LaTeX (suitable for use with Sexpr() in an
Sweave document) or in expression() (suitable for plotting), or plots an axis with labels in scientific
notation
Usage

scinot(x, format = c("latex", "expression"), delim="$",
pref="", ...)
axis.scinot(side,at)

Arguments
x a numeric vector (of length 1)
format produce LaTeX or expression() format?
delim delimiter to add at beginning and end (latex only)
pref text to put before expression (expression only)
side side on which to plot axis
at list of locations/labels
... additional arguments to formatC
这儿使用axis.scinot(),有点缺陷需要修改一下。

#查看包所在位置 
> edit(?axis.scinot())

下载emdbook Package source: emdbook_1.3.9.tar.gz

tar zxvf emdbook_1.3.9.tar.gz emdbook

找到../emdbook/R/emdbook.R
修改scinot()

y[2] <- ifelse(length(grep("^\\+",y[2]))>0,
                 gsub("^\\+0+","",y[2]), #替换为空
                 gsub("^-0+","-",y[2]))

y[2] <- ifelse(length(grep("^\\+",y[2]))>0,
                 gsub("^\\+0+","0",y[2]), #替换为0
                 gsub("^-0+","-",y[2]))

打包程序

tar zcvf emdbook_1.3.9.tar.gz emdbook

安装程序

R CMD INSTALL ./emdbook_1.3.9.tar.gz
>plot(a, log = "y",ylim = c(1,10^-6),yaxt="n", xlim = c(0,5))
>axis.scinot(side=2) ## fix bug!
plot散点图使用科学记数法展示p value_第3张图片

参考:
R语言画图坐标轴的科学计数法

你可能感兴趣的:(plot散点图使用科学记数法展示p value)