I currently use stat_ecdf to plot my cumulative frequency graph.
Here is the code I used
cumu_plot <- ggplot(house_total_year, aes(download_speed, colour = ISP)) +
stat_ecdf(size=1)
However I want the ecdf to be reversed(complementary ecdf). Any ideas of the easiest way to do this?
Cheers!
From the help page of stat_ecdf:
Computed variables
x
x in data
y
cumulative density corresponding x
So this works:
p <- ggplot(dataframe_with_column_Z, aes(x=Z))
p + geom_line(aes(y = 1 - ..y..), stat='ecdf')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With