我读过过去后询问使用scale_reverse,并scale_log10在同一时间.我有一个类似的问题,除了我的规模,我试图"反向"是"鳞片"包中的预定义比例.这是我的代码:
    ##Defining y-breaks for probability scale
    ybreaks <- c(1,2,5,10,20,30,40,50,60,70,80,90,95,98,99)/100
    #Random numbers, and their corresponding weibull probability valeus (which I'm trying to plot)
    x <- c(.3637, .1145, .8387, .9521, .330, .375, .139, .662, .824, .899)
    p <- c(.647, .941, .255, .059, .745, .549, .853, .451, .352, .157)
    df <- data.frame(x, p)
    require(scales)
    require(ggplot2)
    ggplot(df)+
        geom_point(aes(x=x, y=p, size=2))+
        stat_smooth(method="lm", se=FALSE, linetype="dashed", aes(x=x, y=p))+
        scale_x_continuous(trans='probit',
                           breaks=ybreaks,
                           minor_breaks=qnorm(ybreaks))+
        scale_y_log10()
结果情节:
 有关更多信息,我想要达到的尺度是概率绘图比例,它在比例的任一端(0和1)具有更精细的分辨率以显示极端事件,对中值的分辨率不断降低(0.5 ).
有关更多信息,我想要达到的尺度是概率绘图比例,它在比例的任一端(0和1)具有更精细的分辨率以显示极端事件,对中值的分辨率不断降低(0.5 ). 
我希望能够scale_x_reverse同时使用我的scale_x_continuous概率范围,但我不知道如何在任何自定义范围内构建它.对此有何指导?
与其尝试组合两种转换,为什么不转换现有数据然后绘制它呢?下面这个看起来应该是对的。
#http://r.789695.n4.nabble.com/Inverse-Error-Function-td802691.html
erf.inv <- function(x) qnorm((x + 1)/2)/sqrt(2)
#http://en.wikipedia.org/wiki/Probit#Computation 
probit <- function(x) sqrt(2)*erf.inv((2*x)-1) 
# probit(0.3637)
df$z <- probit(df$x)
ggplot(df)+
  geom_point(aes(x=z, y=p), size=2)+
  stat_smooth(method="lm", se=FALSE, linetype="dashed", aes(x=z, y=p))+
  scale_x_reverse(breaks = ybreaks,
                  minor_breaks=qnorm(ybreaks))+
  scale_y_log10()
| 归档时间: | 
 | 
| 查看次数: | 1859 次 | 
| 最近记录: |