Skip to main content

브라우저 창 크기가 너무 작습니다.

대화형 학습을 계속할 수 있도록 브라우저 창 크기를 다시 조정하세요. 너비는 최소 900픽셀로 조정하는 것이 좋습니다.

Learning Objectives

After completing this unit, you’ll be able to:

  • Add a Sankey Viz Extension to your Tableau Worksheet.
  • Format a Sankey Viz Extension.

Sankeys are beautiful, but they’re not the best chart type for every type of data. They’re considered complex charts and should only be used with audiences who are comfortable with complex datasets. Often, a simpler chart can be a better choice.

Sankey diag

For this exercise, you’re looking at a Titanic passenger data set. This data set includes information about ‌passengers on the Titanic, including their class, gender, and if they survived or not.

The data questions that you’re trying to answer are: “Did passenger class correlate to passenger survival?” and, because you know that women and children were prioritized for lifeboats, “Did more women than men survive the sinking of the Titanic?”

Build the Sankey and find out.

Connect Your Tableau Public Account

If you haven’t already, or if your Tableau session has expired, log in to your Tableau Public account in the Playground window to the right. If you don’t already have a Tableau Public account, sign up for one now, and be sure to activate your account before starting this interactive unit. You can find more detailed instructions in The Tableau Data Model badge.

Note

The playground resets if your Tableau Public login session expires or if you refresh the page before completing the unit. We recommend completing this unit in one sitting.

Add the Extension

  1. In the window to the right, you should see the Tableau Add a Viz Extension workbook in Tableau Public for Trailhead. The worksheet is named Sankey.
  2. From the Marks card, expand the Mark type dropdown menu.
  3. Under Viz Extensions, select + Add Extension
  4. In the Add an Extension dialog, under Browse Viz Extensions, select Sankey.
  5. Click Open.
    Tableau Marks card dropdown with Add Extension  highlighted.

The Viz Extension loads in the view, and the mark type changes to Sankey.

Build the Sankey

The Sankey extension is built to use extension-specific encoding for Levels and Links. These can be used with the built-in Marks encoding boxes, Tooltip, and Details to build the Sankey on the worksheet.

Sankey Levels represent the categorical dimensions that the Sankey relates together. In this extension, you can include up to 5 discrete dimensions as Levels.

Sankey Links connect the categories across the Sankey. This encoding sizes the width of each link based on a numeric measure.

  1. From the data pane, drag Passenger Class onto the Level encoding box.
  2. Next, drag Survived onto the Level encoding box.
  3. Next, drag Gender onto the Level encoding box.
  4. Finally, drag Passenger ID (Count) onto the Link encoding box.

It’s important that you make sure that the Passenger ID measure aggregation on the Marks card is set to Distinct Count, not Sum.

  1. Hover over Passenger ID on the marks card and expand the context menu.
  2. Hover over Measure, and make sure that Count (Distinct) has a check mark next to it. If it doesn’t, select Count (Distinct).

Your Sankey is built. What do you notice about the Levels on the viz? At a glance, the Passenger Class levels show that Third Class is taller, and thus, had more passengers in total than First class. Select the Third Class level. The Tooltip tells us that the count of Passenger IDs in Third Class is 491. Now select First Class. The count of Passenger IDs is 216.

Format the Sankey

The developer determines the Mark encoding boxes and formatting options. Check the extension description on the Tableau Exchange for information on the Viz Extension you’re loading. For the Sankey, we can use the Format Extension box to change the level appearance, the color palette, the font, and to hide and show labels.

Sort the Level Columns

You can sort the order of the Marks in the level to aid your analysis. For this exercise, you sort the Survived level so that Yes is on top.

  1. Hover over the Survived field on the Marks card and click the down arrow to open the context menu.

Marks card with Survived pill context menu arrow.

  1. Select Sort.
  2. Under Sort Order, change the sort order from Ascending to Descending.
  3. Click the X in the top right of the dialog to exit the Sort menu.

The Sankey updates so that the Yes mark is at the top of the Survived level. Notice how the shape of the Sankey changes.

Change the Level Appearance

You can change the level appearance to add more or less padding between the levels and edges on the viz, or to increase or decrease the width of the levels.

  1. On the Marks card, select Format Extension.
  2. Under Level Appearance, use the up arrows to increase the Width to 110.
  3. Use the up arrows to increase the Level Padding to 4.

Change the Font

  1. Under Labels, change the Top Header Labels font to Tableau Semibold.
  2. Increase the font size to 12.

Notice how the Top Header Labels change.

Hide and Show Labels

You can toggle Show Top Headers Labels and Show Level Labels on and off. For now, leave Show Labels on.

Change the Color Palette

  1. Under Color, select the dropdown arrow to expand the palette menu.
  2. Change the color palette to the Color Blind palette. This makes the colors more accessible to your audience.
  3. Close out of the Format Extension dialog.

The Sankey diagram is now built and formatted. Isn’t it beautiful? Revisit your data questions.

First: “Did passenger class correlate to passenger survival?” To answer this question, select the marks in the Survived column.

Select the No mark under the Survived column. Look at the width of the links from the different classes. There are much thicker levels across both male and female connected to the No level from the Third Class passengers. The First and Second Class links are fairly similar in width.

Now select the Yes mark under the Survived column. Look at the width of the links from the different classes. The width of the levels across First, Second, and Third class aren’t as obvious.

Second: “Did more women than men survive the Titanic sinking?” To answer this question, click the Female and Male marks in the Gender column and analyze the links going to the Yes and No marks. Are they thicker for Yes or No?

In the next unit, you make a Tableau Table with a different Viz Extension.

Resources