display of ECDF

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

display of ECDF

Bogdan Tanasa
Dear all,

please could you advise me on the following : I would like to display a few
CDF data (the R code is below), by using a set of numerical BREAKS on a X
axis to be shown at EQUAL DISTANCE from each other (although numerically,
the BREAKS are on log10 axis and do not reflecting an equal distance):

df <- data.frame(
  x = c(rnorm(100, 0, 3), rnorm(100, 0, 10)),
  g = gl(2, 100)
)

breaks=c(0.001, 0.01, 0.1, 1, 5, 10, 20, 30, 100)

ggplot(df, aes(x, colour = g)) + stat_ecdf()  +
scale_x_log10(breaks=breaks),

how shall I do it ? thanks a lot !

-- bogdan

        [[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.
Reply | Threaded
Open this post in threaded view
|

Re: display of ECDF

PIKAL Petr
Hi

You should add limits and maybe some rotation to x axis

ggplot(df, aes(x, colour = g)) + stat_ecdf()  +
scale_x_log10(breaks=breaks, limits=c(0.01, 100))+
theme(axis.text.x = element_text(size=8, angle=45))

Cheers
Petr

> -----Original Message-----
> From: R-help <[hidden email]> On Behalf Of Bogdan Tanasa
> Sent: Monday, December 17, 2018 10:42 AM
> To: r-help <[hidden email]>
> Subject: [R] display of ECDF
>
> Dear all,
>
> please could you advise me on the following : I would like to display a few CDF
> data (the R code is below), by using a set of numerical BREAKS on a X axis to be
> shown at EQUAL DISTANCE from each other (although numerically, the BREAKS
> are on log10 axis and do not reflecting an equal distance):
>
> df <- data.frame(
>   x = c(rnorm(100, 0, 3), rnorm(100, 0, 10)),
>   g = gl(2, 100)
> )
>
> breaks=c(0.001, 0.01, 0.1, 1, 5, 10, 20, 30, 100)
>
> ggplot(df, aes(x, colour = g)) + stat_ecdf()  + scale_x_log10(breaks=breaks),
>
> how shall I do it ? thanks a lot !
>
> -- bogdan
>
> [[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.
Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner’s personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/

______________________________________________
[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.