How to Make an X Y Graph in Tableau

Cody Schneider••8 min read

Creating an XY graph, also known as a scatter plot, in Tableau is a simple way to see how two different numbers relate to each other. It’s perfect for answering questions like, "Does more ad spending result in more website traffic?" or "Are our most expensive products also our most profitable?" This guide will walk you through building a basic XY graph in Tableau, enhancing it for deeper analysis, and troubleshooting common issues.

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 is an XY Graph (Scatter Plot)?

An XY graph plots data points on a two-dimensional chart to show the relationship between two numerical variables. One variable is plotted on the horizontal X-axis, and the other is plotted on the vertical Y-axis. Each dot on the graph represents a single data point - for example, a product, a customer, or a marketing campaign.

You use a scatter plot when you want to look for a correlation between your two variables. For example:

  • Do shipping distances and delivery times have a clear relationship?
  • Is there a connection between a student's study hours and their final exam score?
  • Do customers who buy more frequently also spend more per transaction?

If the dots on the graph form a clear line or a curve, you've likely found a relationship. If they’re scattered all over the place like confetti, there probably isn't a strong connection between the two variables.

Preparing Your Data for a Scatter Plot

Getting your data ready for a scatter plot is straightforward. All you need is a dataset with at least two numerical columns (which Tableau calls "Measures") and one categorical column (a "Dimension") that uniquely identifies each data point.

For instance, let's say you want to analyze product performance. Your data might look something like this:

  • Product Name (Dimension)
  • Sales (Measure)
  • Profit (Measure)
  • Discount (Measure)
  • Category (Dimension)

In this scenario, you could create an XY graph to see the relationship between Sales and Profit for each Product Name. The key is having two measures you want to compare and a dimension to show the individual data points.

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-by-Step: Creating a Basic XY Graph in Tableau

Let's build a scatter plot from scratch. We’ll use a business example: plotting Sales vs. Profit for a list of products. This helps identify products that are successful (high sales, high profit) versus those that are struggling (high sales, low profit).

Step 1: Connect to Your Data Source

Open Tableau and connect to your dataset. This could be an Excel file, a Google Sheet, a database, or any other supported source. Once loaded, you'll see your Dimensions and Measures in the Data pane on the left side of the screen.

Step 2: Add Your Measures to the Axes

First, decide which variable will be on the X-axis (the independent variable) and which will be on the Y-axis (the dependent variable). A common practice is to put the variable you think is influencing the other on the X-axis. For our example, we'll see how Sales influences Profit.

  • Drag the Sales measure from the Data pane and drop it onto the Columns shelf. This creates your X-axis.
  • Next, drag the Profit measure and drop it onto the Rows shelf. This creates your Y-axis.

Step 3: What to do When You Only See One Dot

At this point, you’ll probably see just one dot on your screen. This is the most common point of confusion for beginners!

Why is this happening? By default, Tableau aggregates measures. That single dot represents the sum of all sales and the sum of all profit in your entire dataset. It plots one point for the totals, not individual points for each product.

To fix this and see the individual data points, you need to tell Tableau how to break down the view. You do this by adding a dimension to the view.

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

Step 4: Disaggregate Your Data with a Dimension

To break that single dot into many, you need to choose a dimension that gives Tableau the level of detail you want to see. Since we want to see the Sales vs. Profit for each product, we’ll use the Product Name dimension.

  • Find Product Name in your list of Dimensions.
  • Drag Product Name and drop it onto the Detail box in the Marks card.

Instantly, the single dot breaks apart into a scatter plot! Each dot now represents a unique product, plotted according to its total sales and profit.

You can also turn off Tableau’s default aggregation by going to the Analysis menu at the top and unchecking Aggregate Measures. This will plot every single row from your data source, which can be useful but may also slow down performance on very large datasets.

Enhancing Your XY Graph for Deeper Insights

A basic scatter plot is useful, but Tableau lets you add more layers of information to make your analysis even richer. Here are a few ways to level up your chart.

Add a Third and Fourth Variable with Color and Size

What if you want to see which product categories are the most profitable, or which products had the highest discounts? You can use the Color and Size properties on the Marks card to encode more data into your view.

  • Adding Color: Drag a dimension like Category onto the Color box in the Marks card. Tableau will automatically assign a different color to the products in each category. Now you can quickly see if trends exist within certain categories, like whether office supplies (blue dots) are generally less profitable than technology (orange dots).
  • Adding Size: Drag another measure like Discount onto the Size box. The dots will now change in size based on the discount amount given. Bigger dots might represent products with higher discounts, allowing you to instantly see if high-discount items correlate with low profits.

Check for a Relationship With Trend Lines

A trend line can visually confirm if there's a statistical relationship between your X and Y variables.

  1. Go to the Analytics pane (next to the Data pane).
  2. Drag Trend Line from the pane and drop it onto the chart canvas.
  3. Choose the type of trend line you prefer (Linear is the most common).

Tableau will draw a line of best fit through your data points. If you hover over the line, a tooltip will appear showing the R-squared value and p-value. In simple terms, the R-squared value tells you how much of the variation in your Y-axis variable (Profit) can be explained by your X-axis variable (Sales). An R-squared of 0.70 means 70% of the profit variation is explained by sales - a reasonably strong relationship.

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.

Set Performance Benchmarks with Reference Lines

Reference lines are helpful for adding context, like company targets or averages. For example, you can add average lines for both Sales and Profit to create four distinct quadrants.

  1. In the Analytics pane, drag Reference Line onto the chart.
  2. Drop it on the scope you want - like Table to apply it to the whole chart.
  3. When the dialog box appears, set the value to Sales > Average to add a vertical line at the average sales.
  4. Repeat the process to add a horizontal line for Profit > Average.

This creates four quadrants that you can quickly analyze:

  • Top-Right: Stars (High Sales, High Profit)
  • Bottom-Right: Question Marks (High Sales, Low Profit - need investigation)
  • Top-Left: Potential (Low Sales, High Profit)
  • Bottom-Left: Low Performers (Low Sales, Low Profit)

Customize Tooltips for Detail on Demand

A tooltip is the information box that appears when you hover over a data point. By default, it shows the fields you've used in the view. You can customize this to show exactly what you want.

  1. Click on Tooltip in the Marks card.
  2. Use the editor to add, remove, or reformat text. You can add more fields by clicking the Insert button.
  3. You can make the tooltip more readable by typing descriptive labels, such as "Product Category: <Category>."

Final Thoughts

Building an XY graph in Tableau is an excellent skill for any data analyst. By plotting two measures against each other and enriching the view with color, size, and reference lines, you can move from raw data to actionable insights about relationships and performance drivers you might have otherwise missed.

Instead of manually dragging fields onto shelves and learning how Tableau handles aggregation, we built Graphed to help you create powerful visualizations simply by asking. You just describe what you want in plain English, like "Show me a scatter plot of sales vs. profit for each product," and instantly get a live, interactive chart that pulls from all your connected sources without having to manage complex software.

Related Articles