Ola Caster <ola.caster <at> gmail.com> writes:

> It's fairly straightforward to plot cumulative histograms using the hist()
> function. You do something like:
> 
> h <- hist(rnorm(100), plot=FALSE)
> h$counts<- cumsum(h$counts)
> plot(h)
> 
> However, I have failed to find any example where this is done using the
> lattice histogram() function. 


This is not a full solution to your problem with the red line, but at least
comes close (hope so) to your original hist with lattic

library(lattice)
h = sort(rnorm(100),decreasing=TRUE)
df = data.frame(h=h,cum=cumsum(h))
histogram(h~cum,data=df)


Dieter

______________________________________________
R-help@r-project.org mailing list
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 via email to