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.

Environ 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.

Les données dont vous avez besoin

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.

Exemple de CSV
SourceTargetAmount
RevenueCost of Goods420000
RevenueOperating Costs260000
RevenueNet Profit180000
Cost of GoodsManufacturing300000
Cost of GoodsShipping120000
Operating CostsSalaries190000
Operating CostsMarketing70000
Remarques

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.

Les étapes

Le parcours exact dans PlotSet, d'un modèle vierge à un graphique terminé.

  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.

    Le sélecteur de modèles de PlotSet : les catégories de graphiques listées à gauche, la grille 'Bar Charts' ouverte et la carte du modèle 'Bar Chart' affichant son bouton 'Select'.
    Chaque guide commence ici. Choisissez la catégorie, puis le modèle : c'est la même grille quel que soit le type de graphique visé.
  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.

    La vue données de l'éditeur PlotSet : une grille de tableur dont les colonnes 'Name', 'Value' et 'Region' sont remplies de chiffres par province canadienne, à côté du panneau 'Data' qui propose l'import d'un CSV, 'Magic Import' et la synchronisation d'une Google Sheet.
    La vue données, ici sur un projet de graphique en barres. Importez un CSV, extrayez les chiffres d'une image avec 'Magic Import' ou synchronisez une Google Sheet. Le panneau est identique pour tous les types de graphique.
  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.

    Le panneau de données de PlotSet avec les associations de colonnes mises en évidence : 'Label/time' affecté à la colonne A, 'Values' à la colonne B et 'Filter/color' à la colonne C, et le bouton 'Auto Binding' juste en dessous.
    Les associations déterminent quelle colonne devient l'étiquette, laquelle fournit les valeurs et laquelle pilote la couleur. 'Auto Binding' les devine à partir de vos en-têtes : vérifiez-les plutôt que de les tenir pour acquises.
  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.

    L'éditeur PlotSet sur l'onglet 'Preview' : un graphique Sankey Diagram terminé sur le canevas, avec le panneau de réglages entouré en rouge le long du bord droit.
    L'onglet 'Preview' pour un graphique Sankey Diagram. Tous les réglages de style se trouvent dans le panneau entouré en rouge : apparence, en-tête, pied de page et les options propres à ce type de graphique, chacun dans un onglet distinct.
  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.

Partez du modèle Sankey Diagram avec des données d'exemple déjà chargées, puis remplacez-les par les vôtres.

Ouvrir le modèle

Publier, intégrer ou exporter

La dernière ligne droite est la même pour tous les types de graphique : 'Share' transforme le graphique en lien public actif et en code d'intégration, 'Export' l'enregistre sous forme de fichier statique.

Share : lien public et code d'intégration

Activer le code d'intégration et le lien public revient à publier le graphique. Le lien peut être envoyé à qui vous voulez sans risque, et le code d'intégration s'insère dans n'importe quelle page sous la forme d'une iframe qui conserve les infobulles au survol et l'interactivité. Si vous modifiez le graphique par la suite, cliquez sur 'Recreate' pour répercuter ces changements sur le lien comme sur le code.

La barre d'outils de l'éditeur PlotSet avec le bouton 'Share' mis en évidence, juste à côté du bouton 'Export'.
C'est par 'Share' qu'un graphique terminé devient un lien public et un code d'intégration.
La fenêtre 'Share' de PlotSet : l'interrupteur qui active le code d'intégration et le lien public, les boutons 'Link', 'Embed', Facebook, Reddit, Twitter, LinkedIn et Email, et le lien public du graphique avec un bouton 'Copy'.
Activez le code d'intégration et le lien public, puis copiez le lien ou récupérez l'iframe. 'Recreate' répercute vos modifications ultérieures sur le lien et le code déjà partagés.

Export : SVG, PNG ou JPG

Le bouton 'Export' génère une copie statique à la taille dont vous avez besoin. Le SVG reste net à toutes les échelles et peut encore être modifié dans un outil de design ; PNG et JPG sont les choix sûrs pour les présentations et les documents. C'est le multiplicateur d'échelle qui vous donne une image nette sur un écran retina.

La barre d'outils de l'éditeur PlotSet avec le bouton 'Export' mis en évidence.
C'est par 'Export' que vous obtenez un fichier statique pour une diapositive ou un rapport.
La fenêtre 'Export chart' de PlotSet : un sélecteur d'échelle réglé sur 2x, les champs de largeur et de hauteur à 1000 × 600, et le menu des formats ouvert, affichant SVG, PNG et JPG.
Le SVG reste net à toutes les tailles et modifiable dans un outil de design ; PNG et JPG sont les choix sûrs pour une présentation. Réglez l'échelle avant d'exporter pour que l'image soit nette sur un écran retina.

Conseils de style pour un 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.

Erreurs courantes en créant un 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.

En savoir plus sur le Sankey Diagram

Vous n'êtes pas sûr que le Sankey Diagram soit le bon choix ? Découvrez ce que c'est, quand l'utiliser et quand l'éviter.

À propos du Sankey Diagram

Sankey Diagram : questions fréquentes

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.

Créez votre Sankey Diagram maintenant

Gratuit pour commencer avec plus de 300 modèles. Aucune carte bancaire requise.