How to Add a Key in Tableau

Cody Schneider8 min read

If your chart or map doesn't have a key to explain what the colors, shapes, or sizes mean, it's just a collection of pretty shapes. In Tableau, this "key" is officially called a legend, and it's the critical link between your data visualization and your audience's understanding. This guide will walk you through exactly how to add, manage, and customize legends in Tableau to make your dashboards clear and effective.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

What Exactly is a Tableau Key (or Legend)?

In data visualization, a key or legend is a small guide on your chart that decodes the visual elements. It answers questions like:

  • What does the dark blue portion of this bar chart represent?
  • Why are some circles on this scatter plot bigger than others?
  • What is the difference between the triangles and the squares?

Tableau automatically generates legends when you use your data to determine the appearance of marks on your chart. "Marks" are the visual elements themselves - the bars, lines, circles, etc. When you tell Tableau to change the color, size, or shape of these marks based on a data field, it creates a legend to explain your choices.

How Tableau Automatically Adds a Legend

The easiest way to add a legend is to let Tableau do it for you. This happens automatically whenever you drop a data field onto the Color, Size, or Shape cards on the Marks shelf. Let's look at a simple example.

Imagine you've built a basic bar chart showing total sales by product category. It's informative, but what if you want to see how different regions contribute to these sales? This is where a legend comes in.

Step 1: Add a Field to the Color Card

From your Data pane on the left, find your 'Region' dimension. Click and drag this field directly onto the Color card in the Marks shelf.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Step 2: See Your Legend Appear!

As soon as you drop 'Region' onto Color, two things happen:

  1. The bars in your chart are broken down into different colors, one for each region.
  2. A Color Legend instantly appears to the right of your visualization, matching each region to its assigned color.

This same principle applies to Size and Shape. If you dragged a measure like 'Profit' to the Size card, the width of the bars would change, and a Size Legend would appear to explain the different sizes. If you changed your mark type to a shape, dragging 'Region' to the Shape card would assign a unique shape to each region and generate a corresponding Shape Legend.

Showing, Hiding, and Manually Adding a Legend

Sometimes you might close a legend by accident and need to bring it back. Or maybe you're working with a complex sheet and the legend didn't automatically pop up where you wanted it.

To view or hide a legend, find the small down arrow on the card for which you want a legend (Color, Size, or Shape). Click it, and you’ll see the option to Show Legend or Hide Legend.

Another way is to use the top menu. Navigate to Worksheet > Show Legend, and select the legend you need. You can also right-click on an empty space inside a Mark Card (like the Color card) and select Show Legend.

Editing and Customizing Your Tableau Legend for Clarity

An auto-generated legend is a great start, but a well-designed dashboard often requires some customization to make the key crystal clear for your audience. Here are the most common ways to edit your legend.

1. Changing the Legend Title

The default title is usually the name of the data field (e.g., "Region"). This isn't always user-friendly. To change it, you have two simple options:

  • Double-click the title of the legend itself. A text box will appear for you to type in a new title.
  • Click the small down arrow at the top right of the legend and select Edit Title...
GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

2. Editing Colors for Better Readability or Branding

The default colors Tableau chooses might not match your company's branding or provide enough contrast. To change them:

  1. Click the down arrow on the legend and select Edit Colors...
  2. A dialog box will open. On the left, select a data item (like 'Central' or 'South'). On the right, select a new color from the palette.
  3. Pro Tip: Use the "Assign Palette" button to quickly apply a new color scheme to all items at once. This is great for applying color-blind friendly or sequential color palettes.

3. Reordering Legend Items

You may want to arrange the items in your legend in a specific order (e.g., from largest to smallest, or alphabetically). To do this, simply click and drag the items directly within the legend box itself to place them in the correct order.

4. Changing the Legend Layout (Single Row vs. Single Column)

By default, legends appear as a vertical list (a single column). This can take up a lot of valuable dashboard real estate. You can change this to be a horizontal row:

  1. Click the down arrow on the legend.
  2. Go to Arrange Items.
  3. Select either Single Row or Single Column. The single row option is perfect for saving vertical space on a crowded dashboard.

Using Legends Effectively on a Dashboard

After you finalize your legend on a worksheet, the next step is adding it to a dashboard. This introduces a new concept: Tiled vs. Floating objects.

What's the Difference Between Tiled and Floating?

  • Tiled (Default): When you drag your sheet onto a dashboard, the legend will appear as a "tiled" object. This means it fits into a grid system and doesn't overlap with other items. If you add or resize something, the tiled legend will automatically resize or move to make space.
  • Floating: A floating legend can be placed anywhere on the dashboard, even on top of other objects like your chart or map. This gives you exact control over positioning and is often used to place a compact legend in an empty corner of a map.

How to Make a Legend Float

  1. Add your worksheet to the dashboard. Your tiled legend will appear.
  2. Select the legend object on the dashboard. You'll see a gray border appear around it.
  3. Click the down arrow at the top right corner of this border.
  4. Select Floating from the menu.

Now you can freely drag the legend anywhere on your dashboard. This is incredibly useful for creating clean, professional-looking layouts where every pixel counts.

Common Tableau Legend Troubleshooting Tips

Even with a tool as intuitive as Tableau, you can hit a few snags. Here are solutions to the most common problems related to legends.

"My legend didn't appear!"

This almost always means you haven't put a data field on the Color, Size, or Shape cards. A legend only exists if Tableau needs to explain one of those visual encodings. Go back to your worksheet and make sure a dimension or measure is properly placed on one of those three cards.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

"Someone told me to add a filter, and now my legend has disappeared!"

If you have multiple worksheets on a dashboard that use the same legend, Tableau often consolidates them. But if one of those sheets gets filtered out completely, the legend might vanish. The fix is to select one of the remaining charts on the dashboard that should have the legend, click its down arrow, and find the Legends menu to turn it back on.

"My legend shows '(Null)' or an ugly item I want to hide."

You can hide individual items from a legend without removing them from the worksheet entirely. Click the down arrow on your legend and select Edit items... Then, simply uncheck the item you want to hide. Alternatively, you can right-click the specific item directly in the legend and choose "Hide". This is perfect for cleaning up irrelevant or null data points.

Final Thoughts

Mastering legends is a fundamental step in moving from making charts to telling stories with data. By adding, customizing, and thoughtfully placing the key for your visualization, you give your audience the context they need to understand your insights quickly. These small details are often what separate a confusing dashboard from an impactful one.

While mastering the fine details of tools like Tableau is a powerful skill, the time spent on manual chart configuration is time you're not spending on strategy. With Graphed, we automate the entire process. Instead of dragging fields to Marks cards, editing titles, and rearranging legends, you can just ask in plain English: "Show me a bar chart of sales by product category, broken down by region." We instantly build the correct visualization - complete with a perfect legend - so you can skip the setup and get straight to the insights.

Related Articles