Title: Categorical variable: bar charts and column charts
Course: UGQuants (SSPS) > Section: Data Visualisation

Categorical variable: bar charts and column charts

Bar and Column graphs are probably the most common form of visualisation in statistics.  For a single categorical variable, each category is represented by a single bar, the length (or height) of which represents the prevalence of that answer.

Bar graphs involve the bars going horizontally across the page (with the x-axis on the left hand edge of the graph), while column charts are vertical (with the x-axis along the bottom of the graph).  The choice between these two is typically an issue of visual appeal or of wider design issues (like whether the available space on a poster is portrait or landscape in shape).  However, consideration should also be given to whether a specific variable is intuitively vertical or horizontal.  For instance, the issue of height is clearly vertical in nature, and so a graph related to this is best represented as a column chart, while a graph related to the distance between different cities might be more intuitively thought of as horizontal (bar chart).

Figure 9: Bar chart of interest in politics in % Source: ESS 2010 (UK). | Figure 10: Column chart of interest in politics. Source: ESS 2010 (UK).

It is generally easier to compare the length of bars in a bar/column chart than it is to compare the size of slices in a pie chart.  Below is a bar chart of the perceptions of self-reported health in the UK in 10.  In contrast to the pie chart, drawn in the previous section, it is relatively easy to identify the most popular answer in this visualisation.  Note that in this case, the information is identical to the previous pie chart, with the Y-axis representing the percentage of respondents which can be attributed to each category of the variable.  However, this does not mean that the graph can not be further improved by considering the layout of the graph.  For example, if the intention of this graph is to talk about the relative prevalence of each answer, we could reorder the bars from highest to lowest.  Once again, this provides a good example of how the layout of a graph can ease the reading and interpretation of the data presented.

Figure 11: Bar chart of subjective general health in % Source: ESS 2010 (UK). | Figure 12: Bar chart of subjective general health in % in order of frequency Source: ESS 2010 (UK).

A key contrast between a pie chart and bar/column chart is the ability to work in absolute numbers.  Hence instead of talking about the relevant prevalence of each level of self perceived health, the y-axis could be changed to reflect the number of respondents who choose a particular answer.

Figure 13: Bar chart of subjective general health in absolute numbers in order of frequency

Source: ESS 2010 (UK).

However, sometimes the relative difference in the number of respondents selecting the different answers is relatively small as a proportion of the overall sample.  Therefore, the difference in the length of the bars can be hard to detect, since they are all expressed relative to the intercept of the y-axis which is set at zero (i.e. compared to an answer which was picked by no respondents).  In this case, one option is to change the intercept of the y-axis away from zero.  This has the effect of “zooming in” on the top of the different bars, and hence making the difference between them clearer.  However, since the vast majority of such graphs have a y-axis which begins at zero, it is important that the change in y-axis values is made clear to the reader.  In addition, “zooming-in” on the top end of the graph can be seen as exaggerating the difference between the categories represented by the different bars.  This can be misleading, as it can lead to relatively minor differences appearing more important than they actually are.

It is worth briefly returning to the difference between a bar graph and a column graph to illustrate a few generic points about visualisation.  All visualisations should have:

Appropriate title | An appropriate title – which succinctly says what the graph shows – including details of date and cases involved as appropriate
Source of the data | A clear reference to the source of the data and the number of cases involved in the analysis
Title | Each axis should have a clear title as to what it represents, and where an axis represents a particular scale or set of values, labels showing  where these values fall on the axis.

The latter of these can have an influence on whether to use a bar or column chart.  Typically, particularly where labels need to identify categories with relatively long titles, it can be necessary to either use smaller text, or rotate text, to get a label to fit on the graph.  The need to do this can often be reduced by rotating the graph from vertical to horizontal or vice versa.

In addition, we may add grid lines to a graph to make it easier to reference the size of the bar in a graph to the values of the y-axis.   While this can increase readability of the data, too many lines can distract from the appearance  of the graph, making it look cluttered, and indeed make it harder to read across to the y-axis (too many guide lines can cause the reader to experience a kind of cross-eyed effect making it hard to accurately follow a line across to the axis).  A small number of guidelines at regular intervals and related to key values on the y-axis (for instance ever 10% on a bar chart of percentages) can aid interpretation.  These can often be made fainter than the rest of the graph so is not to distract the reader unnecessarily, as illustrated in the first two of the above figures.