【问题标题】:Ridding X and Y Axes of NA and Index Labels Respectively分别去除 NA 和索引标签的 X 轴和 Y 轴
【发布时间】:2013-10-14 07:52:17
【问题描述】:

这是我用于生成矩形图的代码,我希望将 x 和 y 轴标记为如下所示,而不会使它们与标签“索引”和“NA”重叠,如下所示。有什么方法可以删除 NA 和 Index 标签或指定我最初想要的标签吗?

dat <- data.frame(x1=c(1,27,154.94056),
                  x2=c(27,154.94056,155.27056),
                  y=c(0.21294542,0.10480005,0.11760634))

> dat
#     x1       x2         y
#1   1.0000  27.0000 0.2129454
#2  27.0000 154.9406 0.1048001
#3 154.9406 155.2706 0.1176063

with(dat,plot(NA,xlim=c(min(x1),max(x2)),ylim=c(min(y),max(y)+.15),type="n"))
with(dat,rect(x1,y,x2,y+0.1))
title(xlab="chrX Position", ylab="Divergence")

【问题讨论】:

    标签: r plot editing


    【解决方案1】:

    plot 中,设置ylab=''xlab=''

    with(dat, plot(NA, xlim=c(min(x1),max(x2)),
                       ylim=c(min(y),max(y)+.15),
                       type="n", xlab='', ylab='')) # <- specify xlab and ylab here
    with(dat, rect(x1,y,x2,y+0.1))
    title(xlab="chrX Position", ylab="Divergence")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-30
      相关资源
      最近更新 更多