[R] Axis with inverse logarithmic scale
Martin Maechler
m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Tue Jul 28 15:56:10 CEST 2020
>>>>> John Fox
>>>>> on Mon, 27 Jul 2020 12:57:57 -0400 writes:
> Dear Dileepkumar R,
> As is obvious from the tick marks, the vertical axis is not log-scaled:
>> log10(99.999) - log10(99.99)
> [1] 3.908865e-05
>> log10(99) - log10(90)
> [1] 0.04139269
> That is, these (approximately?) equally spaced ticks aren't equally
> spaced on the log scale.
> The axis is instead apparently (at least approximately) on the logit
> (log-odds) scale:
>> library(car)
> Loading required package: carData
>> logit(99.999) - logit(99.99)
> [1] 2.302675
>> logit(99) - logit(90)
> [1] 2.397895
Small remark : You don't need car (or any other extra pkg) to have logit:
logit <- plogis # is sufficient
Note that the ?plogis (i.e. 'Logistic') help page has had a
\concept{logit}
entry (which would help if one used help.search() .. {I don't;
I have 10000 of packages}),
and that same help page has been talking about 'logit' for ca 16
years now (and I'm sure this is news for most readers, still)...
> You can get a graph close to the one you shared via the following:
> library(car) # repeated so you don't omit it
.. and here you need 'car' for the nice probabilityAxis(.) ..
>> logits <- logit(y_values)
>> plot(x_value, logits, log="x", axes=FALSE,
> + xlim=c(1, 200), ylim=logit(c(10, 99.999)),
> + xlab="Precipitation Intensity (mm/d)",
> + ylab="Cumulative Probability",
> + main="Daily U.S. Precipitation",
> + col="magenta")
>> axis(1, at=c(1, 2, 5, 10, 20, 50, 100, 200))
>> probabilityAxis(side=2, at=c(10, 30, 50, 90, 99, 99.9, 99.99,
> 99.999)/100)
>> box()
> Comments:
> This produces probabilities, not percents, on the vertical axis, which
> conforms to what the axis label says. Also, the ticks in the R version
> point out rather than into the plotting region -- the former is
> generally considered better practice. Finally, the graph is not a
> histogram as the original title states.
> I hope this helps,
> John
> --------------------------------------------
> John Fox
> Professor Emeritus
> McMaster University
> Hamilton, Ontario, Canada
> web: https://socialsciences.mcmaster.ca/jfox/
> On 7/27/2020 11:56 AM, Dileepkumar R wrote:
>> I think the attached sample figure is not visible
>> Here is the sample figure:
>> https://drive.google.com/file/d/16Uy3JD0wsEucUv_KOhXCxLZ4U-3wiBTs/view?usp=sharing
>>
>> sincerely,
>>
>>
>> Dileepkumar R
>>
>>
>>
>>
>> On Mon, Jul 27, 2020 at 7:13 PM Dileepkumar R <dileepkunjaai using gmail.com>
>> wrote:
>>
>>> Dear All,
>>>
>>> I want to plot a simple cumulative probability distribution graph with
>>> like the attached screenshot.
>>> But I couldn't fix the y-axis scale as in that screenshot.
>>>
>>> My data details are follows:
>>>
>>> y_values
>>> =c(66.78149,76.10846,81.65518,85.06448,87.61703,89.61314,91.20297,92.36884,
>>> 93.64070,94.57693,95.23052,95.75163,96.15792,96.58188,96.97933,97.29730,
>>> 97.59760,97.91556,98.14520,98.37485,98.57799,98.74580,98.87829,99.06377,
>>> 99.16093,99.25808,99.37290,99.45239,99.54072,99.59371,99.62904,99.66437,
>>> 99.69970,99.70853,99.72620,99.73503,99.77036,99.79686,99.80569,99.82335,
>>> 99.83219,99.84985,99.86751,99.87635,99.87635,99.90284,99.90284,99.90284,
>>> 99.91168,99.92051,99.92051,99.93817,99.93817,99.93817,99.95584,99.95584,
>>> 99.97350,99.97350,99.97350,99.97350,99.97350,99.97350,99.97350)
>>>
>>> x_value=seq(63)
>>>
>>> Thank you all in advance
>>>
>>> Dileepkumar R
>>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list