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 ______________________________________________ [hidden email] 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. |
Dear Dileepkumar R,
On 2020-07-27 19:13 +0530, Dileepkumar R wrote: | Dear All, | | I want to plot a simple cumulative | probability distribution graph with | like the attached screenshot. The screenshot disappeared somewhere. Perhaps you can try to upload it somewhere, or attach it as a png? | But I couldn't fix the y-axis scale as | in that screenshot. You scale the y axis using ylim, removing it using yaxt="n", defining a new one using graphics::axis like in the last example in ?graphics::plot: png( filename = "/tmp/ecdf.png", width = 480, height = 480, units = "px", pointsize = 12, bg = "transparent", res = 100) ymin <- 0 ymax <- 100 graphics::plot( x=x_value, y=y_values, ylim=c(ymin,ymax), yaxt="n") e.y <- ymin:ymax at.y <- 10^e.y FUN <- function(E) bquote(10^.(E)) labels <- as.expression( parallel::mclapply(X=e.y, FUN=FUN)) graphics::axis( side=2, at = at.y, col.axis = "orange", las = 1, labels = labels) dev.off() Best, Rasmus ______________________________________________ [hidden email] 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. signature.asc (849 bytes) Download Attachment |
In reply to this post by കുഞ്ഞായി kunjaai
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 <[hidden email]> 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]] ______________________________________________ [hidden email] 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. |
In reply to this post by കുഞ്ഞായി kunjaai
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 You can get a graph close to the one you shared via the following: library(car) # repeated so you don't omit it > 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 <[hidden email]> > 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]] > > ______________________________________________ > [hidden email] 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. > ______________________________________________ [hidden email] 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. |
In reply to this post by കുഞ്ഞായി kunjaai
On 27/07/2020 11:56 a.m., 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 <[hidden email]> > 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 >> You need to figure out what scale was used. It looks to me like a logit scale in y/100. If that's right, this may show what you want: scale <- function(y) log(y/100/(1-y/100)) plot(x_value, scale(y_values), axes = FALSE) axis(1) ticks <- c(10, 30, 50, 90, 99, 99.9, 99.99, 99.999) axis(2, at=scale(ticks), labels=ticks) box() It doesn't have as large a range as your plot; this will match that: plot(x_value, scale(y_values), axes = FALSE, ylim = scale(c(10, 99.9995))) The rest of the code is the same. Duncan Murdoch ______________________________________________ [hidden email] 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. |
In reply to this post by Fox, John
Thanks a lot, John Fox.. Its working
Dileepkumar R Postdoctoral Researcher, Interdisciplinary Centre for Water Research (ICWaR), Indian Institute of Sciences, Bangalore, 560012 Mob: 9953035600, skype id: dileepkunjaai On Mon, Jul 27, 2020 at 10:27 PM John Fox <[hidden email]> wrote: > 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 > > > You can get a graph close to the one you shared via the following: > > library(car) # repeated so you don't omit it > > 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 <[hidden email]> > > 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]] > > > > ______________________________________________ > > [hidden email] 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. > > > [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. |
In reply to this post by Fox, John
>>>>> 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 <[hidden email]> >> 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]] >> >> ______________________________________________ >> [hidden email] 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. >> > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] 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. |
>>>>> Martin Maechler
>>>>> on Tue, 28 Jul 2020 15:56:10 +0200 writes: >>>>> 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)... but now I see that car uses the "empirical logit" function, where plogis() provides the mathematical logit(): The former is typically needed for data transformations where you don't want to map {0,1} to -/+ Inf but rather to finite values .. So I should stayed quiet, probably.. Martin >> 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 <[hidden email]> >>> 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]] >>> >>> ______________________________________________ >>> [hidden email] 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. >>> >> ______________________________________________ >> [hidden email] 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. > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] 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. |
In reply to this post by Martin Maechler
Dear Martin,
On 7/28/2020 10:17 AM, Martin Maechler wrote: >>>>>> Martin Maechler >>>>>> on Tue, 28 Jul 2020 15:56:10 +0200 writes: > >>>>>> 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)... > > but now I see that car uses the "empirical logit" function, > where plogis() provides the mathematical logit(): Not quite the empirical logit, because we don't know the counts, but a similar idea when the proportions include 0 or 1. Also, logit() recognizes percents as well as proportions, and so there's no need to convert the former to the latter. > > The former is typically needed for data transformations where > you don't want to map {0,1} to -/+ Inf but rather to finite > values .. > > So I should stayed quiet, probably.. Well, I wouldn't go so far as that. Best, John > > Martin > > > >> 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 <[hidden email]> > >>> 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]] > >>> > >>> ______________________________________________ > >>> [hidden email] 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. > >>> > > >> ______________________________________________ > >> [hidden email] 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. > > > ______________________________________________ > > [hidden email] 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. > > ______________________________________________ > [hidden email] 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. > ______________________________________________ [hidden email] 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. |
Free forum by Nabble | Edit this page |