How a Histogram Works to Display Data


Investopedia / Joules Garcia

What Is a Histogram?

A histogram is a graphical representation of data points organized into user-specified ranges. Similar in appearance to a bar graph, the histogram condenses a data series into an easily interpreted visual by taking many data points and grouping them into logical ranges or bins.

Key Takeaways

  • A histogram is a bar graph-like representation of data that buckets a range of classes into columns along the horizontal x-axis.
  • The vertical y-axis represents the number count or percentage of occurrences in the data for each column
  • Columns can be used to visualize patterns of data distributions.
  • In trading, the MACD histogram is used by technical analysts to indicate changes in momentum.
  • The MACD histogram columns can give earlier buy and sell signals than the accompanying MACD and signal lines.

How Histograms Work

Histograms are commonly used in statistics to demonstrate how many of a certain type of variable occur within a specific range.

For example, a census focused on the demography of a town may use a histogram to show how many people are between the ages of zero - 10, 11 - 20, 21 - 30, 31 - 40, 41 - 50, 51 -60, 61 - 70, and 71 - 80.

This histogram example would look similar to the chart below. Let's say the numerals along the vertical access represent thousands of people. To read this histogram example, you can start with the horizontal axis and see that, beginning on the left, there are approximately 500 people in the town who are from less than one year old to 10 years old. There are 4,000 people in town who are 11 to 20 years old. And so on.

Histograms can be customized in several ways by analysts. They can change the interval between buckets. In the example referenced above, there are eight buckets with an interval of ten. This could be changed to four buckets with an interval of 20.

Another way to customize a histogram is to redefine the y-axis. The most basic label used is the frequency of occurrences observed in the data. However, one could also use percentage of total or density instead.


Investopedia / Julie Bang

Histograms vs. Bar Charts

Both histograms and bar charts provide a visual display using columns, and people often use the terms interchangeably. Technically, however, a histogram represents the frequency distribution of variables in a data set. A bar graph typically represents a graphical comparison of discrete or categorical variables.

Create a Histogram

You can create a histogram using Microsoft Excel using the Histogram tool associated with the Statistical icon.

Histogram Example: The MACD Histogram   

Technical traders may be familiar with a notable histogram example, the moving average convergence divergence (MACD) histogram. It's a popular technical indicator that illustrates the difference between the MACD line and the signal line.

For example, if there is a $5 difference between the two lines, the MACD histogram graphically represents this difference. The MACD histogram is plotted on a chart to make it easy for a trader to determine a specific security’s momentum.

A histogram bar is positive when the MACD line is above the signal line, and negative when the MACD line is below the signal line. An increasing MACD histogram indicates an increase in upward momentum, while a decreasing histogram is used to signal downward momentum.

Histogram Example

Investopedia / Sabrina Jiang

Trading With the MACD Histogram

A weakness of using just the MACD line and signal line is the lagging nature of the signal given. Specifically, when the MACD line crosses over the signal line, the trading signal lags price. As the two lines are moving averages, by definition they do not cross until a price move has already occurred. This means that traders forego a portion of an initial move.

Traders shouldn't overlook the MACD histogram when using the MACD indicator to make trading decisions. The MACD histogram helps to alleviate the signal lag problem by generating earlier entry signals.

Traders can track the length of the histogram bars as they move away from the zero line. For instance, they may feel that the histogram is generating a trading signal when a histogram bar is shorter in length than the preceding bar. Once the smaller histogram bar completes, traders might open a position in the direction of the histogram’s decline.

Other technical indicators should be used in conjunction with the MACD histogram to increase the signal’s reliability. Moreover, traders should place a stop-loss order to close out the trade if the security’s price does not move as anticipated.

What Is a Histogram in Simple Terms?

A histogram is a graph that shows the frequency of numerical data using rectangles. The height of a rectangle (the vertical axis) represents the distribution frequency of a variable (the amount, or how often that variable appears). The width of the rectangle (horizontal axis) represents the value of the variable (for instance, minutes, years, or ages).

What Is a Histogram vs. a Bar Graph?

The histogram displays the distribution frequency as a two-dimensional figure, meaning the height and width of columns or rectangles have particular meanings and can both vary. A bar chart is a one-dimensional figure. The height of its bars represent something specific. The width of the bars has no meaning. On a histogram, there are no gaps between columns. Column width changes as the variable represented changes. On bar charts, the bars usually have gaps between them.

When Should a Histogram Be Used?

In general, a histogram can be used whenever there's a need to display a comparison of the distribution of certain numerical data in various ranges of intervals. Histogram examples can help an audience see and understand quickly and easily essential meanings and patterns related to a large amount of data. They can be a benefit to a company's or organization's process of decision-making in various departments.

Article Sources
Investopedia requires writers to use primary sources to support their work. These include white papers, government data, original reporting, and interviews with industry experts. We also reference original research from other reputable publishers where appropriate. You can learn more about the standards we follow in producing accurate, unbiased content in our editorial policy.
  1. Microsoft. "Create a Histogram."

Open a New Bank Account
The offers that appear in this table are from partnerships from which Investopedia receives compensation. This compensation may impact how and where listings appear. Investopedia does not include all offers available in the marketplace.