Many histogram functions part of scientific analysis software has the default configuration to fill the histogram. Examples are Matlab and Matplotlib. On the other hand, the default for line plots is to not fill the area below the line. Both behaviours can be altered.

One disadvantage of filling is that it makes it more difficult to visualise different quantities in the same axes, unless it is natural to stack them. What is the reason that it is usual to fill the area under a histogram?

Below is the same data with histograms shown in three different ways using Matplotlib:

A traditional bar-style histogram (hist(X, 50, histtype='bar', edgecolor='none')):

Bar-style histogram

A step-style histogram (hist(X, 50, histtype='step')):

Step-style histogram

And finally, a step-fill histogram with α=0.2 (hist(X, 50, histtype="stepfilled", alpha=0.2)):

Step-fill histogram, α=0.2

  • $\begingroup$ I don't know whether we here at CV are the best people to ask for why something is visualized in a particular way, although we likely can supply no end of opinion. If you don't get a good answer here, you may want to consider flagging your question and requesting migration to UX.SE, where they in fact do have questions on histograms. $\endgroup$ Dec 4, 2015 at 16:06
  • 1
    $\begingroup$ @StephanKolassa I was in doubt between here and Graphic Design, didn't think of UX. Despite the question being why, I believe it should be answerable based on research on how information is perceived, though. $\endgroup$
    – gerrit
    Dec 4, 2015 at 16:09
  • $\begingroup$ "based on research on how information is perceived" - which I'd expect the nice folks at UX.SE to be more familiar with than us. We will see. $\endgroup$ Dec 4, 2015 at 16:12

1 Answer 1


It's hard to know the "why". Such practices are often an unknown mix of convention and usefulness. Certainly the the earliest histograms were filled (History of Histograms), so convention can't be discounted, but filling does have some useful connotations for single-variable histograms:

  • Outlined rectangles suggest the binning
  • Filling shows the area, which emphasizes density
  • Area implies a zero-origin and can stand without a labeled y-axis
  • Filled histograms approximate filled density curves, fitting the area under a curve concept

As you note, filled rectangles are not good for overlaying distributions. If that were a common usage, filling might be less common. On the other hand, just using outlines can obscure the binning in certain cases (adjacent equal-height bins look like one bin).

  • 2
    $\begingroup$ +1. In practice one extra answer often is "to make them look more colourful". Conversely, I am often struck at how much simpler and easier on the eye it is to translate large slabs of colour to background (assuming naturally that bar outlines remain). $\endgroup$
    – Nick Cox
    Feb 14, 2016 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.