PlotSet LogoPlotSet

How to Create a Sankey Diagram

A step by step walkthrough for turning a source, target and value spreadsheet into a published Sankey diagram in PlotSet, from shaping the sheet to exporting or embedding the finished flow.

About 9 minutes

This guide shows how to create a Sankey diagram in PlotSet starting from a plain three column spreadsheet, source, target and value, with nodes named automatically from whatever text sits in those columns and link widths sized to match. We use a budget flow as the running example, but the same three columns work just as well for a website funnel, an energy balance or a customer journey.

Set aside nine minutes if your rows are already in source, target, value shape. That climbs by five if you're reconciling a spreadsheet with a totals row mixed into the real flows, or working out how to fold a dozen small categories into one node before upload.

The data you need

Three columns, one row per flow: where the amount comes from, where it goes, and how much. Nodes are created automatically from whatever names appear in the source and target columns, so there is no separate list of nodes to maintain.

Sample CSV
SourceTargetAmount
RevenueCost of Goods420000
RevenueOperating Costs260000
RevenueNet Profit180000
Cost of GoodsManufacturing300000
Cost of GoodsShipping120000
Operating CostsSalaries190000
Operating CostsMarketing70000
Notes

Every amount is a positive number. A Sankey link has no concept of a negative flow, so a refund or a loss needs its own row and its own honestly named target, such as "Returns", rather than a minus sign.

A name that appears in both a source and a target column becomes one node with flow passing through it, which is exactly how a multi-stage diagram like the budget example above works.

Keep source and target names spelled identically everywhere they appear. "Marketing" and "marketing " with a trailing space will render as two separate nodes rather than merging into one.

If a node's inflows and outflows do not add up, PlotSet still draws it, just with a visibly lopsided shape. Reconcile the numbers in your spreadsheet before uploading rather than after.

The steps

The exact click path in PlotSet, from a blank template to a finished chart.

  1. 01

    Open the Sankey diagram template

    From the PlotSet dashboard, start a new project and choose the Sankey template. It loads with sample data already bound, so you can see the exact three column shape (source, target, value) before you touch your own file.

    PlotSet's template picker: chart categories listed down the left, the Bar Charts grid open, and the Bar Chart template card showing its Select button.
    Every guide starts here. Pick the category, then the template: it is the same grid whichever chart type you are after.
  2. 02

    Shape your sheet into source, target and value

    Rework your spreadsheet into one row per flow, in that column order. A pivot table or a report with running totals will not work as is: pull out the individual transitions first, one row per movement from one stage to the next.

  3. 03

    Upload the file or connect a live sheet

    Import a CSV or .xlsx file from the data panel, paste rows directly from a spreadsheet, or connect a Google Sheet if you want the diagram to refresh later without a re-upload. PlotSet reads the first row as your headers.

    The PlotSet editor's data view: a spreadsheet grid with Name, Value and Region columns filled with Canadian province figures, beside the Data panel offering CSV upload, Magic Import and Google Sheet sync.
    The data view, shown here on a bar chart project. Upload a CSV, lift the numbers out of an image with Magic Import, or sync a Google Sheet. The panel is identical for every chart type.
  4. 04

    Map the source, target and value columns

    Confirm which column feeds each role. This is usually automatic when your headers read clearly as Source, Target and Value or similar, but check it by hand if your sheet carries extra columns PlotSet might have guessed on.

    The PlotSet data panel with the column bindings highlighted: Label/time mapped to column A, Values to column B and Filter/color to column C, with the Auto Binding button below.
    Bindings decide which column becomes the label, which supplies the values and which drives the colour. Auto Binding guesses them from your headers, so check it rather than assume it.
  5. 05

    Order the stages left to right

    PlotSet places nodes by the order flow moves through them, but if your data has a natural sequence (acquisition before conversion before retention, for instance), check the node order matches that story rather than an alphabetical default.

  6. 06

    Label the nodes and turn on link values

    Rename any node whose spreadsheet name would confuse a reader, such as an internal code, to something they would recognize. Turn on the value label so hovering, or the static label itself, shows the exact number each link carries.

  7. 07

    Set node and link colour

    Colour links by their source node by default, which is what lets a reader's eye follow one path through the crossings. Reserve a distinct colour for a terminal node you want to call out, such as a loss or a drop-off, rather than colouring every node differently.

    The PlotSet editor on the Preview tab: a finished Sankey Diagram on the canvas, with the settings panel outlined in red down the right-hand side.
    The Preview tab for a Sankey Diagram. Every styling control lives in the outlined panel, each on its own tab: appearance, header, footer and the options specific to this chart type.
  8. 08

    Publish, embed or export the diagram

    Publish for a live, interactive diagram where hovering a link shows its exact value and a shareable link, grab the embed code for a page, or export a PNG, SVG or PDF for a deck or report.

Start from the Sankey Diagram template with sample data already loaded, then swap in your own.

Open the template

Publish, embed or export it

The last stretch is the same for every chart type: Share turns the chart into a live public link and an embed code, Export writes it out as a static file.

Share: public link and embed code

Activating the embed code and public link publishes the chart. The link is safe to send to anyone, and the embed code drops into any page as an iframe that keeps the hover tooltips and the interactivity. Edit the chart later and hit Recreate to push those changes out to both.

The PlotSet editor toolbar with the Share button highlighted, sitting next to the Export button.
Share is how a finished chart becomes a public link and an embed code.
PlotSet's Share dialog: the toggle activating the embed code and public link, buttons for Link, Embed, Facebook, Reddit, Twitter, LinkedIn and Email, and the public chart link with a Copy button.
Switch on the embed code and public link, then copy the link or take the iframe. Recreate pushes later edits out to everyone already holding it.

Export: SVG, PNG or JPG

Export writes a static copy at whatever size you need. SVG stays sharp at any scale and can still be edited in a design tool; PNG and JPG are the safe choices for slides and documents. The scale multiplier is what gets you a crisp image on a retina screen.

The PlotSet editor toolbar with the Export button highlighted.
Export is the route to a static file for a slide or a report.
PlotSet's Export chart dialog: a 2x scale selector, width and height fields set to 1000 by 600, and the open format menu listing SVG, PNG and JPG.
SVG stays sharp at any size and stays editable in a design tool; PNG and JPG are the safe picks for a deck. Set the scale before you export so the image is crisp on a retina screen.

Styling tips for a Sankey Diagram

Aggregate the long tail before you upload

If fifteen small categories each carry under two percent of the total, group them into one "Other" node in your spreadsheet before uploading. Ten legible links reading well beats forty threads nobody can trace, and the reader can still see what the group contains from its label.

Name terminal nodes for what actually happened

A node where flow simply stops should say so plainly: "Churned", "Unconverted", "Written off". A vague label like "Other" at the end of a diagram hides the one part most readers came to see.

Keep the stage count at two or three

Two stages show a split, three show a journey. A fourth stage is where crossings start to dominate the picture, so if your data has more steps than that, consider whether two linked diagrams tell the story more clearly than one dense one.

Let link width do the talking, skip a legend

Because width already encodes the amount, a separate legend explaining colour usually repeats information the diagram already shows. Put your effort into a title that states what is flowing and over what period instead.

Common mistakes when making a Sankey Diagram

A node looks wider on one side than the other

This means the inflows and outflows for that node do not sum to the same total. Add up both sides in your spreadsheet: if quantity genuinely disappears at that step, add an explicit row sending the difference to a named node like "Loss" instead of leaving it unbalanced.

The same category shows up as two separate nodes

Check for a spelling or capitalization mismatch between the source and target columns, most often a trailing space or an inconsistent abbreviation. A TRIM and a consistent name in your spreadsheet before re-uploading fixes this in one pass.

The diagram is a tangle of thin crossing links

This happens past roughly a dozen nodes on one stage. Go back to the spreadsheet and merge the smallest categories into a single named group, then re-upload. It is much easier to fix in the source data than to untangle visually after the fact.

Learn more about the Sankey Diagram

Not sure the Sankey Diagram is the right choice? See what it is, when to use it and when not to.

About the Sankey Diagram

Sankey Diagram: common questions

Three columns: source, target and value, one row per flow. Nodes are created automatically from whatever names appear in the source and target columns, so there is no separate node list to build or maintain before uploading.

Make your Sankey Diagram now

Free to start with 300+ templates. No credit card required.