Tableau charts: Histogram graph
Updated: May 17
Histogram graph just like the box plot is used to show distribution of data. By appearance, it looks like a column chart – unlike column chart, histogram is created by grouping values into ranges (bins). Such bins could either be based on a fixed bin size or a varying bin size depending on developer’s goals. The height of the bar shows the number of values falling within a particular range.
Example of histogram graph
Best practice for creating histogram graph.
Ensure the chart tells a meaningful story by choosing the right bin sizes. Avoid choosing too wide or too small bins sizes.
Label the axis and bins clearly.
Provide additional details on the tooltip.
If need be, use parameters to let users choose the appropriate bin sizes.
Related: How to create a box plot in Tableau.
Step by step guide on how to create a histogram graph in Tableau
Using Superstore data set pre-packaged with Tableau app, we’ll create a histogram graph to show the distribution of Profit for this data. Just like in the case of box plot, Tableau allows us to create a histogram by just two clicks using the ‘Show Me’ tab located at the top right corner.
Using ‘Show Me’ tab to create a histogram
Once you’ve connected above data set with Tableau app;
Drag measure field Profit to the rows shelf or columns shelf.
Open ‘Show Me’ tab and select histogram,
Executing above we’ve a histogram below;
Looking carefully at this graph, you’ll note that the size of bins are uniform, actually the size is 283 to be precise, however Tableau allows you to edit size of bin by selecting the field ‘Profit (bin)’ on the dimension field >> Edit.. (Note; this field 'Profit (bin)' was automatically generated when I selected histogram on the Show Me tab, however you can create it by selecting Profit>>Create>>Bin...).
Using the resulting popup-menu, you can adjust the size of bin or even deploy a parameter to empower end users select bin size of choice.
This first example is based on use of uniform bin size to create a histogram, which sometimes may not meet the business needs. Since for this example most of the data lies between -1,000 and 1,000, a good histogram would explore the distribution of data within this range and combine the rest of data together (as outliers). To achieve this, we will need now to create a histogram with varying bin size.
Histogram with varying bin size.
We’ll be using a calculated field to create bin size of 250 for all values between -1,000 and 1,000 and then merge the rest as ‘Profit>1,000’ and ‘Profit<-1,000’.
Right click anywhere on the dimension or measure field area>>Create>>Calculated Field…
Enter the calculation below;
Now, let’s create our histogram;
Drag the calculated field ‘Varying Size Bin’ to the columns shelf.
Drag the measure field ‘Number of Records’ to the rows shelf.
Right click on the field ‘Varying Size Bin’ on the columns shelf and sort the ‘Varying Size Bin’ manually as shown below.
Executing above give us;
From this histogram, a total of 7,808 products generated profit ranging between zero and 250, with very few products generating high profits. And a good number of unprofitable products.
Using this last example on varying bin size histograms, businesses can map business questions back into their data and understand business phenomena's better, hence responding appropriately.
I hope this article was helpful to you, if you would like to receive more of the Tableau tips and tricks, kindly join our mailing list by subscribing below.
Thank you for reading.