lines( tmp$breaks, c(tmp$counts,tail(tmp$counts,1)), type='s', col='#00ff0077', lwd=5 )
On Thu, Aug 1, 2013 at 1:30 PM, Levi Waldron <lwaldron.resea...@gmail.com>wrote: > 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. > -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com [[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.