This document is the Tableau implementation of the more general, conceptual discussion regarding categorical data visualizations.
The Worksheet
After reading your data into Tableau, open a worksheet by clicking on the highlighted orange tab at the bottom-left of the data window, shown in Figure 1.
Begin with a blank worksheet, which lists the data and variables but without analysis.
The name from relational database that Tableau uses to refer to variables.
Find the variable names in the left-margin, in the Data tab, which distinguishes variables with text values, Abc, versus variables with numeric values, #.
Tableau avoids the standard notation for the x- and y-axes. It uses the term shelves for identifying the variables scaled on the axes, identified by Columns, the x-axis reference, and Rows, the y-axis reference. Figure 2 illustrates the meaning of different aspects of the worksheet, which is embedded in a Tableau Workbook consisting of one or more worksheets and also dashboards and stories, concepts illustrated in later postings.
Regardless if a system is based on written instructions or a graphic user interface (GUI), information is entered into a function for data analysis according to its parameters, sometimes called arguments. Tableau’s function calls and parameter specifications are spread across the worksheet.
A grouped set of icons that each sets related parameter values.
One card often referenced is Marks, which defines the physical characteristics of the visualization, such as colors and labels.
Bar Chart
The following discussions show how to create the bar chart from various sources, beginning with the summary table that results from a prior data aggregation.
From Summary Table
For employment in various company departments, suppose the summary table of the counts is already available, but not the raw data, the original table of data values for each individual. Maybe you located a management report that listed the number of employees in each department and wish to create the corresponding bar chart from that table. Enter the summary table directly into a worksheet app, such as Excel.
Dept n
1 ACCT 5
2 ADMN 6
3 FINC 4
4 MKTG 6
5 SALE 15
This summary or pivot table contains the two variables relevant to the analysis: categorical variable Dept and numerical variable n. There is only one row for each unique value (category) of Dept.
To create the bar chart from the summary table, specify these two variables: categorical variable, \(x\), and numerical variable, \(y\), which maps to each bar’s height. For a bar chart with vertical bars, identify the categorical variable Dept under tables and drag to the Columns shelf which represents the x-axis. Then identify the variable N and drag that to the Rows shelf. The bar chart results. Update The name of the worksheet by right clicking on the tab at the bottom left of the window and enter a new name.
The link to the video of this process follows.
Video: Bar Chart from summary table [1:13]
Find the rendered bar chart in Figure 5.
Aggregate Counts
Creating the bar chart from the original data is generally the same as for the previous example of creating the bar chart from the summary table. The distinction is that we have access to all of the variables in the original data table. As before, we drag the department variable from the tables area to the Columns shelf if we want a vertical bar chart with the columns located on the x-axis. When we have access to the original data, Tableau creates a count variable, which we drag to the Rows shelf, which represents the y-axis. The vertical bar chart results.
The link to the video of this process follows.
Video: Bar Chart from counts from the raw data [1:27]
Aggregate y
Again, generally the same process as the previous to examples, but to do data aggregation on a numerical variable we will drag the numerical variable to the shelf instead of the count variable as we did before. The key element of this process is automatic aggregation.
Tableau automatically aggregates data when you drag a numerical field to the shelf or to a mark, often defaulting to sum..
We want the mean salary not the sum of the salaries in each department. To change from the sum to the mean, right-click on the variable name Salary in the Rows shelf, choose measure, and then average. The result is the bar chart for the average salary in each department.
The link to the video of this process follows.
Video: Bar Chart from aggregating a numerical variable [1:24]
Export the Visualization
To export to an image or .png file, in the open Worksheet, go to the top of the screen to Worksheet menu. Then elect Export and then Image..., shown in Figure 3.
Tableau does not just produce a literal copy of the visualization. Instead, it offers several options that can be included in the exported image. In the Export Image dialog, select the image options for a .png such as size and legend, then click Save, illustrated in Figure 4.
The result follows in Figure 5.
Pie Chart
Creating a pie chart in Tableau involves many steps. Here, we review each successive step. The categorical variable of interest is Dept. We will have the pie slices reflect the count of the employees in each department. The procedure for creating the pie chart is distinct from the procedure previously described for creating the bar charts.
A pie chart visualization has no axes, so instead of using the Columns and Rows shelves, create the pie chart only from setting various Marks parameters.
To create the pie chart, set the Marks parameters by dragging the labels for the field names to specified Marks icons.
Also, here we introduce a general Tableau property, which is a property of any data analysis system. What is unique is the way Tableau implements the assignment of parameters to the underlying visualization function.
More than one parameter setting may be assigned to a given variable via the Marks card.
Every system allows specifying multiple parameters to a function call. To do this assignment in Tableau, duplicate the field name label for a variable by selecting a label for one mark and then holding the Command or Control key down while dragging the label to another Mark.
Following is the specific procedure to create the pie chart of counts for the different departments.
- Under the
Marksheading is a drop-down menu labeledAutomatic. From that menu selectPie. - Drag the Dept field name toward the
Markscard, placing the name over theColormark to indicate that we want colors to vary for the pie slices that represent different departments. - As an option, add a border between each slice. Click on the
Colormark and selectBorder:. Choose a border color such as white. - Select the desired
measurefor which to specify the pie slice areas, hereCount. Drag the field name toward theMarksand drop on theDetailmark. This allows the metric of the numerical variable to be specified as a label to each of the pie slices. - Right-click or select the drop-down menu on the label
CNT(d), chooseQuick Table Calculation, and thenPercent of Total. - Drag the
CNT(d)label to theAnglemark to have the angles, and so the size of the pie slices, reflect their respective percentage contribution to the overall pie. - Label the slices with their respective percentages by dragging the
CNT(d)label to theLabelmark to define anothermarkfor the counts. - Also label the slices with their respective level names by CMD/CTRL dragging the
Deptlabel to theLabelmark, which creates another field label for the variable beyond the one for the color parameter setting. - The order in which the marks appear on the visualization depends upon the order in which they are listed in the
Marksarea. Drag the field name labels into the order you wish for the display, such as listing the name of the level over the corresponding percentage. - Expand the view of the pie chart from the drop-down menu at the top of the Tableau window that shows
Standard. Select from that menu the choice ofEntire View.
Figure 6 shows the settings of the Marks parameters and the resulting Tableau pie chart.
The link to the video of this process follows.
Video: Pie Chart from of counts from the raw data [3:12]
Because Tableau treats Count as another continuous variable, any other measure could have been selected too determine the size of the pie slices.
Dot Plot
Tableau does not provide a dot (lollipop) chart. This is not too concerning because the bar chart can be used in its place. Oh
Bubble Plot
To construct the bubble plot we will again focus on two variables: Categorical variable Dept and Numerical variable Count. We want Dept to determine the number of bubbles, five, and to provide a label for each level of Dept, that is, each department. We want Count to specify the respective sizes of the bubbles. Tableau plots the bubbles (circles) in two-dimensions instead of along a single line.
To set the parameter values, drag the Dept field label over to the Color mark. For Count, drag to the Size mark. Now the size of the corresponding bubbles, that is, circles, correspond to the number of people who are employed in each department. To label the bubbles, drag the department field label over to the Label mark. Find the result in Figure 7.
Figure 7 shows the settings of the Marks parameters and the resulting Tableau bubble chart.
The link to the video of this process follows.
Video: Bubble plot [2:05]
Waffle Chart
Tableau does not provide a waffle chart. This is not too concerning given the availability of the other categorical data visualizations and that waffle charts are not that common, though because of that they can offer a different style of chart to provide some novelty.
Treemap Chart
To construct the tree map visualization, begin the same process as constructing the bar chart: drag the department variable label to the column shelf, then drag the variable label for numerical variable of interest, here Count, to the row shelf. The bar chart then appears.
Now move to the top right of the Tableau window to find the Show Me tab. Click on the tree map icon and the tree map appears. Click on the color Marks to edit the color as desired. The result appears in Figure 8.
The link to the video of this process follows.
Video: Tree map [1:25]