【问题标题】:logi.hist.plot moving axis labels rlogi.hist.plot 移动轴标签 r
【发布时间】:2015-08-10 03:41:56
【问题描述】:

您好,我正在尝试使用 popbio 包创建一个 logi.hist.plot,但第二个 y 轴标签似乎侵占了轴刻度。这是我正在使用的代码:

 molters
 logiplot<-logi.hist.plot(elevations,molters,boxp=FALSE,type="hist",col="gray",xlab="Elevation (Km)",scale.hist=3,intervalo=.1,ylabel="Probability of Molting",ylabel2="Frequency of Molting Wilson's warbler",counts=F)

我真的只需要将第二个 y 轴标签向右移动一点。非常感谢任何帮助。

【问题讨论】:

    标签: r graphics axis-labels


    【解决方案1】:

    您可以使用mtext 在页边空白处放置文本。

    library(popbio)
    
    ## example from ?logi.hist.plot
    data(aq.trans)
    aq.trans$survived<-aq.trans$fate!="dead"
    a<-subset(aq.trans, leaf<50 & stage!="recruit", c(leaf,survived))
    logi.hist.plot(a$leaf,  a$survived, 
                   type="hist", boxp=FALSE, counts=TRUE, int=10, 
                   ylabel="Survival probability", ylabel2="",  # blank the label
                   xlab="Number of leaves" )
    
    ## Adjust right label
    ylabel2 <- "Number of plants"
    mtext(ylabel2, 4, col="red")           # initial
    mtext(ylabel2, 4, padj=1, col="blue")  # move right (could also use 'line' argument)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-03
      • 1970-01-01
      • 1970-01-01
      • 2015-07-27
      • 2020-11-09
      • 1970-01-01
      • 2021-10-26
      相关资源
      最近更新 更多