I want to represent a histogram by the line along its top border, *without*
kernel smoothing (to show several histograms in the same plot). This works,
but is there simpler recommended way?

x <- rnorm(1000)
tmp <- hist(x, border="white")
for (i in 1:(length(tmp$breaks)-1)){
    segments(x0=tmp$breaks[i], x1=tmp$breaks[i+1], y0=tmp$counts[i])
    segments(x0=tmp$breaks[i+1], y0=tmp$counts[i], y1=tmp$counts[i+1])
}

        [[alternative HTML version deleted]]

______________________________________________
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