Building Packed Bubble Charts

Packed bubble charts let you display data in a cluster of circles. You use dimensions to define the individual bubbles, and measures to define the size and/or color of the individual circles. Packed bubble charts are a relatively simple data visualization that can provide insight in a visually attractive format.
In Tableau, you create a packed bubble chart by first placing one or more dimensions on the Columns shelf and one or two measures on the Rows shelf. Then choose packed bubbles from Show Me.
The following exercise walks your through creating a basic packed bubble chart that shows sales and profit information for different product categories.
  1. Connect to the Sample - Superstore - English (Extract) data source, which is included with Tableau Desktop.
  2. Drag the Department dimension to Columns.
    A horizontal axis is created showing product categories.
  3. Drag the Sales measure to Rows.
    The measure is automatically aggregated as a sum and a vertical axis is created.
    Tableau displays a bar chart—the default chart type when there is a dimension on the Columns shelf and a measure on the Rows shelf.
  4. Choose the packed bubbles chart type from Show Me:

    Tableau displays the following packed bubble chart:

  5. Drag Region to Detail on the Marks card to get more bubbles in the view. There isn't enough space on this page to make the image big enough to show labels for all the circles. With a bigger image, more labels would display, but it's often the case that some bubbles will be too small even when the view is fairly large. When this happens, hover over a bubble to see the tooltip.

    At this point you can continue adding dimensions to the view to multiply the number of circles—packed bubble charts that show hundreds of bubbles can be interesting for some purposes. Or you can drag a second measure to color, to add another layer of information to the view.
  6. Drag Profit to Color on the Marks card:

  7. Drag Region to Label on the Marks card so that users won't be confused by seeing identical labels on different circles:

    The size of the bubbles shows the sales for different combinations of region and department; color shows profit (the darker the green, the greater the profit).
There is plenty more you could do to develop this view. You could edit the colors for Profit to use a diverging palette (so that negative profit shows in a different color), or you could create a calculated field that showed profit divided by sales (that is, profit margin) and drop that on Color instead of absolute profit. For more information, see Color.

Building Box Plots

Box plots, also known as box-and-whisker plots, are a type of graph that shows the distribution of values along an axis. Boxes enclose the middle 50% of the data (that is, the middle two quartiles of the distribution). Lines, called whiskers, can be configured to display so as to include all points within 1.5 times the interquartile range (in other words, all points within 1.5 times the width of the adjoining box), or at the maximum extent of the data, as in the following image:

In Tableau, box plots are a chart type that you can select from Show Me, and also a type of reference line that you can add to an axis in a view. For more information about box plots, see Reference Lines, Bands, and Boxes. To add a box plot using Show Me and to configure that box plot, right-click the axis and then choose Edit Reference Line, Band, or Box.
The following exercise walks you through creating a set of box plots that show shipping costs on a per-customer basis, by continent and customer segment.
  1. Connect to the Sample - Superstore - English (Extract) data source, which is included with Tableau Desktop.
  2. Drag the Continent dimension to Columns.
    The measure is automatically aggregated as a sum and row headers are displayed, identifying six continents.
  3. Drag the Shipping Cost measure to Rows.
    Tableau creates a vertical axis.
    Tableau displays a bar chart—the default chart type when there is a dimension on the Columns shelf and a measure on the Rows shelf.
  4. Drag the Customer Segment dimension to Columns, and drop it to the right of Continent.
    Now you have a two-level hierarchy of dimensions from left to right in the view, with Customer Segment nested within Continent.
  5. Choose the box-and-whisker plot chart type from Show Me:

    Tableau displays the following box plot:

    Notice that there are only a few marks in each box plot. Also notice that Tableau has reassigned Continent from the Columns shelf to the Marks card. When you changed the chart type to a box plot, Tableau needed to determine what the individual marks in the plot should represent. It decided that the marks should represent continents. This was a reasonable conclusion, but it is not what we wanted.
  6. Drag Continent from the Marks card back to Columns.
    This is what the view now looks like:

    Those horizontal lines are flattened box plots, which is what happens when box plots are based on a single mark.
    Box plots are intended to show a distribution of data, and that can be difficult when data is aggregated, as in the current view.
  7. To disaggregate data, select Analysis > Aggregate Measures. This command is a toggle, and because data is aggregated by default in Tableau, the first time you choose this command it has the effect of disaggregating the data (that is, it removes the check mark from this menu item). For information on disaggregating data, see Disaggregating Data.
    Now, instead of having a single mark for each column in the view, you have a range of marks, one for each row (that is, each customer transaction) in your data source:

    The view is now showing us the information we want to see. The remaining steps have to do with making the view more readable and more attractive.
  8. Click the toolbar button for swapping axes:

    The box plots now lay left-to-right, and we are able to see a lot more information in a more compressed space:

  9. Right-click the bottom axis and choose Edit Reference Line, Band, or Box. The following dialog box opens:

  10. In the Fill drop-down list, select an interesting color scheme. For more on these options, see Adding Box Plots.
    Now your view is complete:

You can see from the density of the marks that sales were greatest in Asia and North America—considering sorting to list the continents in order of total sales revenue. You can also see that the inter-quartile range (from the 25th percentile to the 75th percentile) for shipping costs typically tops out around $30, with a few interesting outliers.

Building Treemaps

Treemaps let you display data in nested rectangles. You use dimensions to define the structure of the treemap, and measures to define the size and/or color of the individual rectangles.Treemaps are a relatively simple data visualization that can provide insight in a visually attractive format.
In Tableau, you create a treemap by first placing one or more dimensions on the Columns shelf and one or two measures on the Rows shelf. Then choose treemap from Show Me.
The treemap you will create in this exercise shows aggregated sales totals across a range of product categories. You then have two options for enhancing this basic treemap.
  1. Connect to the Sample - Superstore - English (Extract) data source, which is included with Tableau Desktop.
  2. Drag the Category dimension to Columns.
    A horizontal axis is created showing product categories.
  3. Drag the Sales measure to Rows.
    The measure is automatically aggregated as a sum and a vertical axis is created.
    Tableau displays a bar chart—the default chart type when there is a dimension on the Columns shelf and a measure on the Rows shelf.
  4. Choose the treemap chart type from Show Me:

    Tableau displays the following treemap:

    In this treemap, both the size of the rectangles and their color are determined by the value of Sales—the greater the sum of sales for each category, the darker and larger its box.
  5. Drag the Ship Mode dimension to Color on the Marks. In the resulting view, Ship Mode determines the color of the rectangles—and sorts them into three separate areas accordingly—and Sales determines the size of the rectangles:

  6. To examine another option to modify the treemap, click the Undo button to remove Ship Mode from view. For more information, see Undo and Redo.
  7. Drag the Profit measure to Color on the Marks card. Now Profit determines the color of the rectangles, and Sales is determining their size:

Treemaps cannot accommodate more than two measures—one to control size, the other to control color. Treemaps can accommodate any number of dimensions, but you can only use one dimension to diversify the view, by dragging it to color. Other dimensions can be used only to multiply the number of rectangles in the view. Dimensions cannot be displayed in a hierarchy.

Building Pie Charts

In Tableau there are pie charts, which are visualizations in which data is divided into wedge sectors in a round graph, illustrating numerical proportion, and there are pie marks, which are pie charts that you use as a mark type in a visualization, such as a map. For more information about pie marks, see Pie Mark.
Pie charts can be as effective as bar charts for showing proportions. Pie marks are very useful, for example, to demonstrate a percentage of marketing expenses by state.
The first exercise in this topic shows you how to create a view that used a pie chart.

Building a Pie Chart

This exercise walks you through creating a pie chart view that shows how different product categories contribute to total sales.
  1. Connect to the Sample - Superstore - English (Extract) data source, which is included with Tableau Desktop.
  2. Drag the Sales measure to Columns.
    The measure is automatically aggregated as a Sum.
  3. Drag the Category dimension to Rows.
    The default chart type is a bar chart:

  4. Choose the pie chart type from Show Me:

    The result is a rather small pie:

  5. To make the chart bigger, hold down Ctrl + Shift and press B several times. This is equivalent to selecting Format >Cell Size >Bigger.
  6. Press and hold Ctrl as you drag the Category dimension from the Data window to Label on the Marks card.
    Labels are necessary because your pie chart only makes sense if your users can know what the individual slices represent.

  7. Press Ctrl + Shift + B to make sure most of the individual labels are visible.
A basic pie chart isn't all that interesting on its own, but it can be a useful ingredient in a dashboard, especially if you use actions to show data proportions (in the pie chart) for different values in a dimension. See Actions and Dashboards for details.

Building a Map with Pie Marks

This exercise walks you through creating a map view that shows sales totals for the US states (just the 48 contiguous states). The mark type is Pie, with the mark for each state showing the proportion of total sales for each ship mode (delivery truck, express air, regular air).
  1. Open the Sample - Superstore - English (Extract) data source, which is included with Tableau Desktop.
  2. Double-click the State dimension.
    Tableau adds State to Detail on the Marks card. Because Tableau has automatically assigned the State dimension a geographic role, it shows a map when you double-click it.
    For the Sample - Superstore - English (Extract) data source, Tableau has also automatically created a hierarchy of geographic roles (mapping items), which includes Country/Region, State, City, and Postal Code:

    Tableau will look for these kinds of geographical fields in any data source.
    When you double-click State, Tableau automatically adds Country/Region and State to Detail. See Geographic Roles for information on how Tableau interprets geographical data in data sources.
  3. To zoom the map in on the continental United States, drag Country/Region from the Data window to Filters. This opens a Filter dialog box:

  4. Click None to clear all selections, scroll down and select United States of America, and then click OK.
    The map rescales to show the continental United States:

    (This is just a partial image—the full image is too large to show here.)
  5. Drag the Sales measure to Size on the Marks card.
    The marks in the view resize according to sales in each state.
  6. From the Mark type drop-down list, selecting Pie:

    There is no obvious change in the view, but the next step will not work as intended unless you have done this.
  7. Drag the Ship Mode dimension to Color on the Marks card.
    The view is now nearly finished—the only problem is that the marks (that is, the pie marks) are too small.
  8. Click Size on the Marks card and drag the slider to the right about two-thirds of the way across:

Your view is now complete--your map shows pie chart marks for each state. The size of each pie corresponds with the sales total for that state; the slices of the pie show what proportions of the total were provided by each of the three available ship modes:

Building Gantt Bar Charts

Gantt charts are useful for displaying the duration of events or activities over time. In a Gantt Bar Chart, each separate mark (usually a bar) shows a duration. For example, you could use a Gantt chart to display average delivery time for a range of products. For more information about Gantt bar mark type, see Gantt Bar Mark.
The following exercise walks you through using Gantt charts to show how many days, on average, elapse between order date and ship date. The data is broken out by product category and ship mode. The view displays results on a weekly basis for a three-month period.
  1. Connect to the Sample - Superstore - English (Extract) data source, which is included with Tableau Desktop.
  2. Drag the Order Date dimension to Columns.
    The date is automatically aggregated by year, and column headers are created with labels showing the years in your data.
  3. Right-click the Order Date field on the Columns shelf and choose Week Number:

    The column headers change—the individual weeks are indicated by tick marks because there are too many weeks in a four-year span (208) to show as labels in the view:

  4. Drag Category and Ship Mode dimensions to the Rows shelf, dropping Ship Mode to the right of Category.
    This builds a two-level nested hierarchy of dimensions along the left axis:

    Now we want to size the marks according to the length of the interval between the order date and the ship date. But there are no measures that we can use to capture that interval. However, we can create such a measure by creating a calculated field.
  5. Right-click anywhere in the Data window (on the far left) and choose Create Calculated Field:

    This opens the Calculated Field dialog box. This option is also available from the Analysis menu.
  6. Name your calculated field OrderUntilShip.
  7. Clear any content that may be in the Formula box by default.
  8. Type (or copy) the following formula and click OK:
    DATEDIFF('day',[Order Date],[Ship Date] )
    This creates a custom measure that captures the difference between the Order Date and Ship Date values, in days.
  9. Drag the OrderUntilShip measure to Size on the Marks card.
    The default aggregation for OrderUntilShip is Sum. But we're not interested in adding all the intervals—it makes more sense to average them.
  10. Right-click the SUM(OrderUntilShip) field on the Marks card, choose Measure (Sum), and then choose Average:

    The view is coming along. But there are too many marks squeezed into the view:

    We can make our data more readable by filtering down to a smaller time window.
  11. Hold down the Ctrl key and drag the Week(Order Date) field from the Columns shelf to the Filter shelf.

    By holding down the Ctrl key, you tell Tableau that you want to copy the field to the new location, with whatever customizations you have added, without removing it from the old location.
    A Filter Field dialog box opens. Click Range of Dates and then click Next, to display this dialog box:

  12. Set the range to a three-month time interval, such as 1/1/2012 to 3/31/2012, and the click OK.
    It can be difficult to get the exact date using the sliders—it's easier just to type the numbers you want directly into the date boxes.
  13. Drag the Ship Mode dimension to Color on the Marks card.
    You now have a view that lets you see all sorts of information about the lag between order times and ship times:

    Which ship modes are more prone to longer lag times? Do lag times vary by category? Are lag times consistent over time?
If you publish this view to Tableau Server, you can include Quick Filters that let users interact with the view by varying the time window, or filtering out various categories or ship modes. For more information, see Publishing Workbooks.

Building Heat Maps

Heat maps are a great way to compare categorical data using color. In Tableau, you create a heat map by placing one or more dimensions on the Columns shelf and one or more dimensions on the Rows shelf. You then select Square as the mark type and place a measure of interest on the Color shelf. You can enhance this basic heat map by size-encoding and/or shape-encoding the cells in the table.
The following exercise walks you through using a heat map to explore how profit varies across regions, product categories, and customer segments.
  1. Connect to the Sample - Superstore - English (Extract) data source, which is included with Tableau Desktop.
  2. Drag the Customer Segment dimension to Columns.
    Headers are created with labels derived from the dimension member names.
  3. Drag the Region and Category dimensions to Rows, dropping Category to the right of Region.
    Headers are created with labels derived from the dimension member names. You have now created a nested table of categorical data (the Category dimension is nested within the Region dimension).
  4. Drag the Profit measure to Color on the Marks card.
    The measure is automatically aggregated as a sum. The color legend reflects the continuous data range.
  5. Optimize the view format:
    • From the Format menu, select Cell Size > Square Cell.
    • Increase the mark size by pressing Ctrl+Shift+B. Hold down Ctrl+Shift and continue to press B until the squares are large enough.
    • Make the columns wider by pressing Ctrl+Right arrow. Hold down Ctrl and continue pressing the Right arrow key until the headings for Category are displayed in full:

      These cell formatting options are also available when you select Cell Size from the Format menu.
      In this view, you can see data for only for the Central region. You must scroll down to see data for other regions. Or you can maximize the Tableau Desktop window.
      In the Central region, office machines seem to be the most profitable category, and bookcases the least profitable.
  6. Click Color on the Marks card to display configuration options. In the Border drop-down list and chose a medium gray color for cell borders, as in the following image:

    Now it's easier to see the individual cells in the view:

  7. To make the colors more distinct, hover over the top right corner of the SUM(Profit) color legend, and then click the downward triangle that appears. The following menu of options is displayed:

  8. Click Edit Colors. In the Edit Colors dialog box, select Use Full Color Range:

    When you select this option, Tableau assigns the starting number a full intensity and the ending number a full intensity. If the range is from -10 to 100, the color representing negative numbers changes in shade much more quickly than the color representing positive numbers. If you do not select Use Full Color Range, Tableau assigns the color intensity as if the range was from -100 to 100, so that the change in shade is the same on both sides of zero. (See Color for more on color options.) The effect is to make the color contrasts in your view much more distinct:

  9. Drag the Sales measure to Size on the Marks card to control the size of the boxes by the Sales measure. This enables you to compare absolute sales numbers (by size of the boxes) and profit (by color).
    Initially, the marks are too small:

  10. To adjust the size of the marks, click Size on the Marks card to display a size slider:

  11. Drag the slider to the right until the boxes in the view are the optimal size. Now your view is complete:

  12. Use the scroll bar along the right side of the view to examine the data for different regions. Notice what's going on in the International region.

Building Scatter Plots

Scatter plots provide an easy way to visualize relationships between numerical variables. In Tableau, you create a scatter plot by placing at least one measure on the Columns shelf and at least one measure on the Rows shelf. If these shelves contain both dimensions and measures, Tableau automatically places the measures as the innermost fields, which means that measures are always to the right of any dimensions you have also placed on these shelves. The word "innermost" in this case refers to the table structure.
Creates Simple Scatter Plot Creates Matrix of Scatter Plots
A scatter plot can use several mark types. By default, Tableau uses the shape mark type. Depending on your data, you might want to use another mark type, such as a circle or a square. For more information, see Mark Types.
The following exercise walks you through using scatter plots and trend lines to compare sales to profit:
  1. Open the Sample - Superstore - English (Extract) data source, which is included with Tableau Desktop.
  2. Drag the Profit measure to Columns.
    The measure is automatically aggregated as a sum and a horizontal axis is created.
  3. Drag the Sales measure to Rows.
    The measure is automatically aggregated as a sum and a vertical axis is created.
    Measures contain continuous numerical data. When you plot one number against another, you are comparing two numbers; the resulting chart is analogous to a Cartesian chart, with x and y coordinates.
    What you have at this point is the most basic kind of scatter plot: a one-mark scatter plot:

  4. Drag the Department dimension to Color on the Marks card.
    This separates the data into three marks—one for each dimension member—and encodes the marks using color.

  5. Drag the Region dimension to Detail on the Marks card.
    Now there are many more marks in the view. The number of marks is equal to the number of distinct country/regions in the data source multiplied by the number of departments. (If you're curious, see what would have happened if you'd dropped the Region dimension on Shape instead of Detail.)

  6. Right-click in the view and choose Trend Lines >Show Trend Lines to add trend lines.
    A trend line can provide a statistical definition of the relationship between two numerical values. To add trend lines to a view, both axes must contain a field that can be interpreted as a number—by definition, that is always the case with a scatter plot.
    Tableau adds three linear trend lines—one for each color that you are using to distinguish the three departments:

  7. Hover the cursor over the trend lines to see statistical information about the model that was used to create the line:

    For more information, see Assessing Trend Line Significance. You can also customize the trend line to use a different model type or to include confidence bands. See Adding Trend Lines.

    See Also

    Example – Scatter Plots and Aggregation