From c77e3408bd58e1b959e8f3b416454d6935209988 Mon Sep 17 00:00:00 2001 From: janik Date: Fri, 17 Jul 2026 20:37:28 +0700 Subject: [PATCH] Raster map: THT pad barrels get their own marker and legend entry Every barrel was drawn with the same green dot under one 'vias' legend label, making through-hole pads read as vias. Pad barrels (kind='pad') now draw violet with a 'THT pad barrels' entry; the legend lists only the barrel kinds present. Co-Authored-By: Claude Fable 5 --- fill_resistance/plots.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/fill_resistance/plots.py b/fill_resistance/plots.py index ebf59e1..53bce17 100644 --- a/fill_resistance/plots.py +++ b/fill_resistance/plots.py @@ -50,6 +50,7 @@ _COPPER = "#c98b4e" _E1_COLOR = "#c8385a" _E2_COLOR = "#2f6fb0" _VIA_COLOR = "#2d6b45" +_PAD_COLOR = "#5b4a8a" # THT pad barrels (kind='pad'), violet-ink _SOLDER = "#9aa3ad" # tin-gray: solder buildup areas _MESH = "#a56c33" # darker copper: adaptive leaf boundaries _INK = "#3a3a3a" @@ -187,10 +188,14 @@ def _electrode_labels(ax, stack, e1_l, e2_l): def _via_markers(ax, problem, layer): - xs = [v.x * 1e-6 for v in problem.vias if v.spans(layer.z_nm)] - ys = [v.y * 1e-6 for v in problem.vias if v.spans(layer.z_nm)] - if xs: - ax.plot(xs, ys, ".", ms=2.5, color=_VIA_COLOR, alpha=0.7) + """One dot per barrel spanning the layer: vias green, THT pad + barrels violet (same joint markers, different physics).""" + for kind, color in (("via", _VIA_COLOR), ("pad", _PAD_COLOR)): + pts = [(v.x * 1e-6, v.y * 1e-6) for v in problem.vias + if v.kind == kind and v.spans(layer.z_nm)] + if pts: + xs, ys = zip(*pts) + ax.plot(xs, ys, ".", ms=2.5, color=color, alpha=0.7) def area_tag(sign: str, index: int) -> str: @@ -243,8 +248,12 @@ def fig_raster(stack, e1, e2, problem, result=None): _electrode_labels(ax, stack, e1[li], e2[li]) def finalize(fig, rows): - handles = [Patch(fc=_COPPER, label="copper"), - Patch(fc=_VIA_COLOR, label="vias")] + kinds = {v.kind for v in problem.vias} + handles = [Patch(fc=_COPPER, label="copper")] + if "via" in kinds or not kinds: + handles.append(Patch(fc=_VIA_COLOR, label="vias")) + if "pad" in kinds: + handles.append(Patch(fc=_PAD_COLOR, label="THT pad barrels")) if has_mesh: handles.append(Patch(fc=_MESH, label="adaptive mesh (coarse leaves)"))