[FIX] Report layout polish — title helper, trajectory y-labels, clock legend, rose whitespace - #84
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A broad pass over the report figures, driven by rendering a full ADCP mooring (
dsK1_1_2026: ADCP + aquadopp + microcat + rbrsolo + seapoint + tr1050) — cases the clean single-Aquadopp dune2 fixture never exercises. It adds a small title/legend/colour helper layer, standardises font sizes through the mplstyle, fixes several figure-layout bugs, and combines the stack report's hydrography (P/T/S) and velocity (U/V/W) panels into single multi-row figures with one shared instrument legend.Changes
Title helper — one switch point for panel-title alignment. New Tier-1 primitives
plot_title(ax, text)(left-aligned panel title) andfigure_title(fig, text)(centredsuptitle) inplotters/primitives.py. Every panel-titleax.set_titleacrosscurrent/ts/hydrography/spectrum/diagnostic/timeseries/primitivesroutes throughplot_title, and figure-levelsuptitles throughfigure_title, so the left-vs-centre policy is a single edit. Colorbar unit labels (cb.ax/cax.set_title) are deliberately left alone. Fixes the grid N² title (was centred while every sibling panel was left) and the grid velocity suptitle (was clipped off the canvas top; the figure now uses constrained layout).Font sizes standardised through the mplstyle. Panel titles and suptitles are now 10 pt (
axes.titlesize/figure.titlesize, matching the axis labels) and colorbar unit labels 9 pt (ANNOT_FS). All scattered magicfontsize=overrides on titles, axis labels, ticks, and most annotations were removed so they inherit the style; contour labels now use the existingCLABEL_FStoken, and the assorted annotation sizes route throughANNOT_FS. Bothoceanarray.mplstyleand the vendoredconfig/report.mplstylewere updated (some report figures set their own style context, so both are needed).Trajectory y-axis labels no longer clipped. The pseudo-Lagrangian trajectory panels lost the leading "N" of "North displacement (km)" once tick labels reached thousands of km. New adaptive helper
ytick_reserve_in(y)sizes the left reserve to the widest tick label, andsquare_axes_gridgained an optionalleft_inoverride (mirroring its existing reserve overrides). Short-displacement trajectories keep the full square (no shrink); only wide-label ones reserve extra. Applied to all four trajectory paths (stack aquadopp + ADCP, grid, and the sharedplot_trajectoryprimitive feeding the instrument page). The square/colorbar-height invariant and the fixed slot-width are preserved.Clock-offset check — colourblind-safe, distinguishable lines.
plot_clock_offset_checkplotted up to 24+ instruments withtab20(20 colours, not CVD-safe), so colours collided and were inaccessible. New reusabledistinct_line_styles(n)helper (+OKABE_ITOpalette) inplotters/helpers.pycycles the 8-colour colourblind-safe Okabe–Ito set and advances linestyle every 8 lines (solid/dashed/dash-dot/dotted, the sparser styles drawn thicker), so up to 32 lines are each uniquely(colour, linestyle). The shared below-axes legend is also sized to its row count and the figure height grows to fit it, so the legend clears the date-offset labels instead of overlapping the panels.Rose grid whitespace trimmed.
draw_rose_gridset only left/right margins, leaving the matplotlib default top/bottom (~1–2 rows of whitespace on a tall grid); top/bottom are now trimmed to a small fixed inch reserve.Rotary spectrum readability.
draw_grid_rotary_spectrumnow shows at most 3 depth levels (the shallowest mapped to near-white), floors the depth colour scale so every kept level is a visible shade, moves the tidal/inertial frequency labels to the top of the panel, and puts the depth legend back at bottom-left with its title dropped so it fits.Combined hydrography and velocity figures (stack report). New
_combined_ts_fig(rows, color_var)builds a stacked multi-variable time series sharing one time axis and one instrument colour scheme (height-ordered), with a single legend over the union of instruments spanning the full figure height. The stack Hydrography section now renders pressure/temperature/salinity as one 3-row figure coloured by the temperature map (dissolved oxygen stays a separate panel — few instruments, no legend problem); the Velocity section renders U/V/W as one 3-row figure. This replaces up to six tall per-variable legends with two, and lets an instrument be followed by colour down the stack. The shared legend anchors to the panels' actual right edge (not the figure edge, which left a gap).Windows figure (
draw_windows): the deploy/recover marker labels are simplified to "YAML" and "Suggested" (was "YAML deploy" / "Sugg. recover" …).Tests
New
test_plotters.pycases:ytick_reserve_in(no-shrink for short labels, monotonic growth, all-NaN fallback),plot_title/figure_titlealignment, anddistinct_line_styles(unique pairs, palette cycling, linewidth tiers, clamping).test_report_golden.pyextended: the PNG-geometry test now also checks row-layout.fig-cellfigures so a row panel's declared slot cannot silently diverge from its adapter's render width. The stack golden was re-baselined for the combined-figure structural change (the intended diff). Full suite: 849 passed, 8 skipped; coverage 68%.Breaking changes
pressure/temperature/salinitypanels are replaced by a singlehydro_ptspanel (one 3-row figure), and the Velocity section'seast_velocity/north_velocity/up_velocitypanels by a singlevel_uvwpanel. Any code or test keying on those stack panel ids, or on the separate figures, must switch tohydro_pts/vel_uvw. Dissolved oxygen is unchanged.pcolormesh_paneldefaulttitle_locchanged from"center"to"left". Both in-repo callers already passed"left"explicitly, so rendered output is unchanged; a caller relying on the old centred default would differ.config/report.mplstyletitle sizes,config/report_tokens.pyANNOT_FS8→9). These are byte-identical-with-ctdcast files; they have been mirrored to ctdcast (ctdcast re-baselines its own PNG-byte golden separately).square_axes_gridgainingleft_inis additive (not breaking).