Map three nonnegative parts into a triangle only after defining what the whole contains.
Ternary plots: preserve the total behind a three-part composition
The triangle represents a closed whole
A ternary plot places three nonnegative components of one whole at a point inside a triangle. A point near a corner has a large share of the component named at that corner. The chart requires a real closure rule: if raw materials, labor and transport make only 83 percent of a project budget, normalizing those three to 100 percent silently discards the remainder. Add a declared other category, change the question or use a different display. Stacked composition is easier when the reader needs several exact shares. A ternary plot earns its space when the trade-off among exactly three parts is itself the question and the total is comparable or available elsewhere.
Keep the raw total next to normalized shares
Closure removes scale. A project costing 47 units and another costing 470 can occupy the same triangle point when their ratios match. Preserve total cost as a table column, size encoding with a disclosed area scale, or a linked separate chart. Do not let marker color quietly reintroduce a fourth variable without a readable legend and accessible alternative. Area-scaled markers explain why marker radius is not proportional to magnitude. Zeros are legitimate triangle-edge cases, whereas negative components or a zero total cannot be mapped as shares. Before plotting, decide whether a recorded zero is a real absence, a rounded small positive amount or missing data; these cases should not share one symbol.
A trend can be a denominator effect
If one component's share rises, at least one other share must fall even when its raw amount is unchanged. That closure constraint can manufacture apparent negative relationships between parts. Compare raw components and totals before attributing a movement to a process change. Correlation heatmaps on closed shares need special care for exactly this reason. If several periods are shown, connect points only when each project ID and period order are stable. Label direction and elapsed time; a long geometric move is a large change in composition, not necessarily a large change in dollars or units. The triangle should not be used as a causal diagram.
Fix corners, orientation and precision
Choose a component order and corner labeling once for every panel and export. Reordering corners rotates the apparent story even when the numbers are unchanged. Use meaningful tick spacing and consistent normalization, preferably with a table reporting the original values and resulting shares to a stated precision. When values are rounded, their displayed shares may sum to 99.9 or 100.1; keep full precision for coordinates and explain display rounding. Parallel coordinates offer another way to inspect several components without enforcing a three-part closure. For accessible interaction, keyboard focus should reveal all three components, the raw total and the record ID, not just an unlabeled point location.
Worked contract
from math import isfinite, sqrt
def triangle_positions(records: list[tuple[str, float, float, float]]):
identifiers = [record_id for record_id, _, _, _ in records]
if len(identifiers) != len(set(identifiers)) or any(not item for item in identifiers):
raise ValueError("composition IDs must be unique and nonempty")
points = []
for record_id, materials, labor, transport in records:
parts = (materials, labor, transport)
if any(not isfinite(part) or part < 0 for part in parts):
raise ValueError("components must be finite and nonnegative")
total = sum(parts)
if total <= 0:
raise ValueError("a zero total has no composition")
x_position = (labor + transport / 2) / total
y_position = (sqrt(3) / 2) * transport / total
points.append((record_id, x_position, y_position, total,
tuple(part / total for part in parts)))
return points
budget_points = triangle_positions([
("depot-47", 47, 31, 22),
("depot-59", 94, 62, 44),
])
assert abs(budget_points[0][1] - 0.42) < 1e-12
assert budget_points[0][1:3] == budget_points[1][1:3]
assert budget_points[0][3] == 100
assert budget_points[1][3] == 200Performance and operating cost
Validating and normalizing N compositions costs O(N) time and O(N) output space. The two budgets share coordinates because their proportions match, yet their totals differ by a factor of two. The function supplies plotting coordinates for corners materials-left, labor-right and transport-top; it does not determine whether the three categories truly exhaust the business total. That semantic check belongs at the data boundary.
Common Mistakes
- Normalizing an incomplete three-part subset without naming the omitted share.
- Comparing triangle distance as though it represented absolute amount.
- Treating closure-induced negative relationships as independent evidence.
- Changing corner order between panels or hiding raw totals after normalization.
Validation drill
Plot 59 project budgets using three exhaustive cost components. Identify any zero-total or negative record, retain the raw totals and explain why two projects with identical shares can require different spending decisions.
