Skip to main content

Network Visualization without Misleading Readers

A network picture can reveal structure and data problems, but it is not a measurement by itself. Force-directed layouts place nodes by an optimization process; layout position is not data, geographic location, influence, or causal effect unless the coordinates explicitly encode such a variable.

Prerequisites​

Complete graph data quality and missing relationships. Only accepted edges should enter the drawing, while declared isolates remain visible.

Learning goals​

  • Match visual channels to direction, weight, category, and uncertainty.
  • Use a fixed seed and recorded parameters for a reproducible layout.
  • Keep labels, legends, isolates, and non-color cues accessible.
  • State what a graph drawing does and does not establish.

A defensible encoding plan​

For the teaching fixture, node labels expose identity, arrowheads expose direction, and line width represents aggregated positive intensity. The drawing includes Gia even though she has no accepted edge. Parallel events are aggregated only for this overview, under the already declared parallel-edge aggregation rule.

Use color sparingly and never as the only channel. If categories matter, combine a colorblind-safe palette with shapes or direct labels. Curved edges can separate reciprocal directions. Report the layout algorithm and fixed seed; otherwise ordinary stochastic movement can look like a substantive change between runs.

For dense graphs, a hairball often communicates less than a table, filtered ego view, small multiples, or an adjacency matrix. Filtering must be visible: removing low-degree nodes or weak edges changes the population shown.

Worked example​

import csv
import os
import tempfile
from pathlib import Path

matplotlib_config = Path(tempfile.gettempdir()) / "datasciencebase-graph-matplotlib"
matplotlib_config.mkdir(parents=True, exist_ok=True)
os.environ["MPLCONFIGDIR"] = str(matplotlib_config)
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import networkx as nx

fixture = Path("tests/fixtures/graph-data-science")
graph = nx.DiGraph()
with (fixture / "interaction-nodes.csv").open(encoding="utf-8") as handle:
graph.add_nodes_from(row["node_id"] for row in csv.DictReader(handle))
with (fixture / "interaction-relationships.csv").open(encoding="utf-8") as handle:
for row in csv.DictReader(handle):
if row["record_status"] != "valid":
continue
source, target, weight = row["source"], row["target"], int(row["weight"])
graph.add_edge(source, target, weight=graph.get_edge_data(source, target, {}).get("weight", 0) + weight)

layout_seed = 52
positions = nx.spring_layout(graph.to_undirected(), seed=layout_seed)
figure, axis = plt.subplots(figsize=(6, 4))
nx.draw_networkx_nodes(graph, positions, node_color="#74c0fc", edgecolors="#102a43", ax=axis)
nx.draw_networkx_labels(graph, positions, font_color="#102a43", ax=axis)
widths = [graph[u][v]["weight"] for u, v in graph.edges]
nx.draw_networkx_edges(
graph, positions, width=widths, arrows=True,
connectionstyle="arc3,rad=0.08", ax=axis,
)
axis.set_axis_off()
figure.canvas.draw()
plt.close(figure)

print(f"drawn_nodes={graph.number_of_nodes()} drawn_edges={graph.number_of_edges()} layout_seed={layout_seed}")
print(f"encodings=labels,arrows,width isolate_visible={'gia' in positions}")

Expected output:

drawn_nodes=7 drawn_edges=9 layout_seed=52
encodings=labels,arrows,width isolate_visible=True

The fixed seed makes this diagnostic view repeatable under the pinned versions. It does not make Euclidean distance in the drawing a graph metric.

Limitations​

  • Occlusion, label overlap, edge crossings, and area perception can hide important structure.
  • Width exaggerates aggregated weight if parallel events, time exposure, or opportunity differ.
  • A fixed seed stabilizes the picture but does not validate the layout objective.
  • Screenshots omit interaction, filters, and provenance unless those are explained nearby.
  • Visual clusters are hypotheses, not detected communities or proof of social groups.

Practice​

Write a caption for this drawing that names the observation window, accepted-edge rule, aggregation, layout and seed, isolate treatment, and one prohibited interpretation. Then propose a table or matrix view for readers who cannot use the diagram.

Next steps​

Next, turn “is this pattern unusual?” into an explicit comparison with random graphs and null models.

Primary sources​

Checked 2026-10-18: NetworkX, spring_layout; NetworkX, draw_networkx_edges; Matplotlib, savefig and figure output; W3C, Web Content Accessibility Guidelines 2.2.