Skip to content

DuPont figures: the eight-batch cluster keeps one colour and one shape - #92

Merged
kgdunn merged 7 commits into
mainfrom
claude/issues-154-156-process-3cu4iq
Sep 8, 2026
Merged

kgdunn merged 7 commits into
mainfrom
claude/issues-154-156-process-3cu4iq

Conversation

@kgdunn

@kgdunn kgdunn commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Follow-up to #84 and #91, on review feedback: the second group of batches was orange in the model B score plot and in the raw panels of the contribution figure, but purple in the model C figure, where orange already stands for batch 49.

What changed

  • The cluster (batches 37, 39, 43 to 48) is now purple with a triangular marker in every figure it appears in, set once as CLUSTER_COLOUR, CLUSTER_MARKER at the top of batch/batch-case-dupont-figures.py. Shape carries the identity alongside colour, so the group is recognised across figures and in print, and orange keeps its single meaning on the page (batch 49).
  • score_plot and group_scatter in batch/batch_case_common.py gain a highlight_marker option for that. It defaults to a circle, so no figure outside the DuPont set changes.
  • In the model C figure the three projected sets are now batch 49 (orange circle), batches 50 to 55 (aqua circle) and the second group (purple triangle), with the triangle drawn slightly larger, since a triangle of equal area reads smaller than a circle.

Verification

Regenerating the whole DuPont set writes three changed PNGs and leaves the rest byte-identical: batch-case-dupont-model-b-scores.png, batch-case-dupont-group-contribution.png and batch-case-dupont-model-c.png. The SBR and FMC sets are untouched.

The book page is updated to match in kgdunn/pid-book#273: the model B code block now highlights the group (it had left that to the committed figure), the model C block gives the group its symbol, and the captions read "purple triangles" rather than "orange".

🤖 Generated with Claude Code

https://claude.ai/code/session_01LXthGpHLQFfGubBiKFtGAE


Generated by Claude Code

The cluster was orange in the model B score plot and in the raw panels of
the contribution figure, but purple in the model C figure, where orange
already stood for batch 49. It is now purple with a triangular marker in
every figure it appears in, so a reader recognises it by shape as well as
by colour, and orange keeps its single meaning.

score_plot and group_scatter gain a highlight_marker option for that; it
defaults to a circle, so no other figure changes. Regenerating the whole
DuPont set touches three PNGs: model B scores, the group contribution and
model C.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXthGpHLQFfGubBiKFtGAE
…d shape

Its two panels sit side by side, and orange meant batch 49 on the right
while marking batches 38, 40, 41 and 42 on the left. Those four are now
magenta diamonds, which clears the colour-vision separation, normal-vision
and contrast checks against the four colours they share the figure with.

Their labels are placed away from the neighbour each would otherwise land
on: 38 sits below batch 21, and 40, 41 and 42 sit together near the centre.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXthGpHLQFfGubBiKFtGAE
On the cooling-water temperature the 51 grey trajectories filled the panel
and the two forecasts had to be read through them. The band covers the
middle 90% of the normal batches at each sample, which is what the reader
needs from them, and leaves the foreground clear.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXthGpHLQFfGubBiKFtGAE
On the cooling-water panel every corner holds something the panel is
about: the rise just after the impurity enters above, the two forecasts
below, the observed trace at the lower left. The legend sat on the first
of those. Both panels now carry their legend under the axes, in two
columns, and the forecast entries lose the word "onwards", which the
prose says and the legend does not need.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXthGpHLQFfGubBiKFtGAE
Three panels from the dryer's own data: the dryer temperature against
clock time, where the batches end anywhere between 93 and 200 time units;
the same batches against aligned sample, all 325 long with their ramps
lined up; and the clock time at each aligned sample, which is the record
of the stretching. The shortest and the longest batch are drawn in colour
so that two very different durations can be followed onto the one grid.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXthGpHLQFfGubBiKFtGAE
…e batches

Kevin's review of the FMC case asked for six things, all on the reader's side
of the page:

- The passage on batch 20's operating conditions described a score plot and a
  set of contributions that no figure showed. Add batch-case-fmc-pls-zop: the
  Zop-to-quality score plot beside the bar chart of what puts batch 20 where it
  is. Its legend sits below the axes, because batch 20 occupies the lower left.
- Batches 61 and 14 are introduced on the quality PCA and then referred to
  again later, so name them in every subsequent score plot: the Zop PLS, the
  three MBPLS panels on the initial conditions, the batch PCA, the batch PLS,
  the batch MBPLS super scores and the three block-score panels.
- The per-sample panel of a contribution triptych marked the phase ends with
  two orange lines but left the reader to count the regions. Name them:
  solvent collection, drying ramp, cool-down.
- The alignment figure showed only the shortest and the longest batch. Add a
  middle one, so the reader sees the range rather than its two ends.

Placing labels by hand stops working the moment a model is refitted, so
annotate_batches chooses each label's side from the laid-out figure: of the
four sides, the one whose text anchor has the most room and is not clipped by
the axes. This is what keeps 13 and 14, which sit side by side, apart.

The triptych's two lower y-labels are longer than their axes are tall, so they
were overlapping the panel above; the title and the top panel already name the
quantity, leaving "Summed per tag" and "Summed per sample" to say the rest.
That change also regenerates the DuPont and SBR triptychs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXthGpHLQFfGubBiKFtGAE
…heck it

A fixed offset cannot keep a label clear. It is smaller than a highlighted
marker's own radius, so the text began inside its own disc; tight_layout moves
the axes after the label is written; and hand-tuned offsets (label_left,
label_north, per-batch dictionaries) go stale the moment a model is refitted.
Measuring the drawn figure removes all three problems at once.

save() now calls place_labels(), which for each auto-placed label compares the
eight sides of its own marker against the markers as drawn, the legend, the
hand-placed text and the other labels, and takes the one with the most room.
A label with nowhere clear steps further out and turns on a leader line, which
is a Line2D of its own so both ends can be set: candidate positions whose
leader would strike through another marker are rejected, because a line
crossing a marker reads as pointing at it. Only a label with nowhere at all to
go keeps a white outline. Three rounds settle it, so the order labels were
added no longer decides the result.

score_plot, influence_plot, parity_plot and the FMC weight plot all go through
it, and label_left / label_north are gone from the three scripts along with the
per-batch offset dictionaries they needed.

check_labels.py is the check: it lays out every figure of a script, measures
each label, and reports any that runs off the figure, intrudes into a marker,
lands on another label or sits under a legend. It reported 37 problems on the
committed figures and reports none now. Measure the glyphs, not the annotation:
Annotation.get_window_extent unions in the leader line, which reaches back to
the point being labelled, so it calls every label a collision with its own
marker.

Also on the SPE triptych: a centred phase name sat on the bars, so each one now
goes to whichever end of its phase the bars leave more headroom, and the three
FMC phase names are in sentence case.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXthGpHLQFfGubBiKFtGAE
@kgdunn
kgdunn merged commit 3bae202 into main Sep 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants