Networks and hierarchies

Network and hierarchy charts show how things nest or connect, from trees and treemaps to force layouts and flows between stages.

LLMs

Usage

When a tree, a treemap, a sunburst, a network graph or a sankey is the right choice, when a table or a simpler chart reads better, and how to draw one that stays readable. The same rules hold in every chart library. For picking between chart types in general, see Choosing a chart.

What it is for

These charts show how things connect, not only how big they are. Each one answers a different question about the connections.
  • A tree shows a strict hierarchy: what sits under what, and how deep it goes.
  • A treemap shows the same hierarchy as nested rectangles, sized by a value, so the big branches stand out.
  • A sunburst shows the hierarchy as rings around a center, one ring per level.
  • A network graph shows links between peers that have no single parent, such as people who work together.
  • A sankey shows a quantity that splits and merges as it moves through stages, with each flow as wide as its value.

When to use

  • The structure is the question: which items belong together, what depends on what, or where a total goes.
  • A hierarchy has a few levels and a few dozen nodes, and the reader needs to see the whole shape at once.
  • A budget, a funnel of orders or an income statement splits into parts and the parts recombine. Use a sankey.
  • You look for clusters and bridges in a small network, such as teams that only connect through one person.

Use something else when

  • The reader compares the size of the branches more than the structure. Use a sorted bar chart of the branches.
  • A network has more than about a hundred nodes, or most nodes link to most others. The graph turns into a hairball. Use an adjacency matrix (a heatmap with the nodes on both axes), or a table of the strongest links.
  • The reader looks up one node and its neighbors. Use a searchable table or a list with the links of the selected node.
  • A flow only loses volume from step to step and never splits. Use a funnel chart or a bar chart of the steps.
  • A whole has two to five parts and no levels. Use a bar chart, or a pie chart for one simple share.
  • The hierarchy is deep and the reader needs exact values. Use a tree table with expandable rows.

How it reads

A tree and a network encode the structure as position and lines. A line is a relationship, and the distance between nodes means little on its own. In a force-directed graph, the layout comes from a simulation, so the same data can settle into a different shape.
A treemap encodes value as area and a sunburst as angle. People read both less accurately than length on a shared scale, so these charts show which branches are large, not by how much. A sankey encodes value as the width of each flow, which reads well for big flows and poorly for thin ones.

Do it well

  • Keep the graph small. Show the top one or two levels, and let the reader open a branch to see the next.
  • Label nodes directly when there are few of them. In a dense graph, label only the important nodes and show the rest on hover and focus.
  • Draw the links first and the nodes on top, in a quiet color, so the nodes stay readable.
  • Color a treemap or a sunburst by its top-level branch, so a branch and its children share one hue.
  • In a sankey, keep every subtotal balanced, so what flows into a node also flows out of it. Label each node with its name and its value.
  • Use color in a sankey for meaning, such as profit and cost, not for each flow.
  • Draw arrowheads only when the links have a direction.

Pitfalls

  • A hairball. Too many nodes and links hide every pattern. Filter, group the nodes, or switch to a matrix.
  • Reading distance in a force graph as similarity. Two nodes far apart may still share a link. State what a link means in the subtitle.
  • Colors that change between renders. A force layout can put a cluster in a different place, so color by a stable group in the data, not by where the cluster lands.
  • Comparing small cells or thin arcs. Small areas and angles are hard to tell apart, and their labels do not fit. Give exact values in a tooltip or a table.
  • A sankey with many crossing flows. Reorder the nodes so flows cross less, or merge small flows into an Other node.
  • A sankey with a cycle, where a flow returns to an earlier node. A sankey cannot draw one. Show the loop as a separate step or as a table.

Variants

  • Tidy tree: one node per item and one line per parent, for structure and depth.
  • Treemap: nested rectangles sized by value, for the size of many branches at once.
  • Sunburst: rings by level, for depth and share together. A drillable sunburst opens one branch at a time.
  • Force-directed network: nodes placed by their links, for clusters and bridges in a small graph.
  • Sankey: weighted flows between stages, for budgets, conversions and statements.

Compared with similar charts

  • Treemap against sunburst: the treemap uses space better and compares sizes more easily. The sunburst shows the levels more clearly.
  • Treemap against a bar chart: bars compare branch sizes more accurately. The treemap shows how the parts nest.
  • Sankey against a funnel: a funnel shows one path that loses volume. A sankey shows flows that split and merge.
  • Network graph against an adjacency matrix: the graph shows clusters in a small network. The matrix stays readable as the network grows and shows each link as a cell.
  • Tree against an indented list: the list holds more nodes and longer labels. The tree shows the shape at a glance.