Choose a meaningful reference, keep a shared scale and retain both values behind every gap.
Diverging bars: put signed differences on one shared zero
The reference is the argument
A diverging bar begins at zero and extends according to a signed difference. That zero must mean something: actual minus plan, current minus prior, or group A minus group B. Put the formula and unit near the axis. A negative result may mean a shortfall, a benefit or simply a lower measurement. Label the groups rather than assuming red always means bad. A shared baseline lets readers compare directions.
Keep both operands available
A difference of 34 could arise from 47 versus 81 or 4,700 versus 4,734. The same bar length does not reveal operational scale. Tooltips and exports should contain both values, the reference version and any denominator used to make a rate. If teams differ sharply in size, a rate difference may answer the comparison better than counts. Denominator design precedes color choice. A gap based on a missing or zero denominator is undefined, not a zero-length bar.
Sort for the decision
Ranking by signed difference groups shortfalls; ranking by absolute difference surfaces the largest departures in either direction. State the sort key. Do not reorder every small multiple independently if the reader must follow the same entity through time. Shared facet order preserves identity. For equal comparison of positive and negative magnitudes, set a symmetric numeric domain around zero. An asymmetric domain can compress one side. Never clip a long bar without an exact value label and visible break.
Expose uncertainty
A small bar near zero may be noise rather than stable movement. For estimates, add an interval marker and explain whether it crosses zero. The chart should not declare every positive value a success. A materiality threshold belongs on the plot only when its rule is documented and consistent across entities. Small-sample uncertainty matters most near the boundary. Include a text alternative listing signed gaps, both operands and the largest departures on either side.
Worked contract
from math import isfinite
def signed_plan_gaps(rows: list[tuple[str, float, float]]
) -> list[tuple[str, float, float, float]]:
names = [name for name, _, _ in rows]
if len(names) != len(set(names)) or any(not name for name in names):
raise ValueError("entity names must be unique and nonempty")
if any(not isfinite(actual) or not isfinite(plan)
for _, actual, plan in rows):
raise ValueError("measurements must be finite")
return sorted(((name, actual, plan, actual - plan)
for name, actual, plan in rows), key=lambda item: item[3])
depot_gaps = signed_plan_gaps([("north", 47, 81),
("south", 113, 97),
("west", 59, 59)])
assert depot_gaps[0] == ("north", 47, 81, -34)
assert depot_gaps[-1][3] == 16Performance and operating cost
For N entities, computing differences takes O(N) time and sorting takes O(N log N) time with O(N) output space. Reusing order across facets avoids repeated sort decisions, though it may make one panel less locally ranked. The example calculates absolute signed differences. A rate gap needs validated denominators and a declared unit before plotting. A chart library's autoscale should not override a specified symmetric domain.
Common Mistakes
- Coloring negative bars as bad when lower is preferable.
- Discarding the actual and plan values after calculating a gap.
- Using unequal left and right scales to exaggerate one direction.
- Confusing percentage-point change with percent change.
Validation drill
Plot 47 depots' actual-minus-plan gaps. Sort by signed difference, show both operands, then compare that ranking to a rate-gap view based on eligible volume.
Read next
- Axis scales, baselines and labels: prevent a correct number from telling a false story
- Aggregation grain and denominator: make every plotted mark auditable
- Small multiples: compare groups with honest scales and facet order
- Uncertainty on charts: show denominators and intervals beside estimates
