Is there any way to control the spacing between bars in a histogram, or change the border width (I'm assuming the hist() function, though alternatives are welcome)? I'm interested in changing the visual spacing between columns in a plotted histogram. The general effect I'm looking for can be accomplished in barplots using the "width=" parameter, but I have not been able to find a way to adjust the apparent spacing in histograms. Thank you, Tom Hopper
A histogram is a density estimate (at least as defined in the Encyclopedia of Statistics Sciences, if not in many US Universities). It is an area, not a series of unrelated bars, so it makes no sense to have spaces between the subareas. Unfortunately, hist() will also produce barplots of counts. On Wed, 9 Feb 2005, Thomas Hopper wrote:> Is there any way to control the spacing between bars in a histogram, or > change the border width (I'm assuming the hist() function, though > alternatives are welcome)? I'm interested in changing the visual spacing > between columns in a plotted histogram. > > The general effect I'm looking for can be accomplished in barplots using the > "width=" parameter, but I have not been able to find a way to adjust the > apparent spacing in histograms.-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Tom, I dealt with this once. barplot.data<- c(2,3,4,5,6) x<- barplot(barplot.data, ylim = c(0,10), space= .9,.9,.9,.9) use the space= to define the spacing between each of your barplot values. If you have groups of bars that you want together, with spaces between the groups, you have to put 0's for each of the unspaced bars. Hope this helps, Zack ----- Original Message ----- From: Thomas Hopper <tomhopper at comcast.net> Date: Wednesday, February 9, 2005 7:02 am Subject: [R] Histogram Bar Spacing or Border Width> Is there any way to control the spacing between bars in a > histogram, or > change the border width (I'm assuming the hist() function, though > alternatives are welcome)? I'm interested in changing the visual > spacing > between columns in a plotted histogram. > > The general effect I'm looking for can be accomplished in barplots > using > the "width=" parameter, but I have not been able to find a way to > adjust > the apparent spacing in histograms. > > Thank you, > > Tom Hopper > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting- > guide.html