Repository navigation
feat: box-and-arrow diagrams, profile bands and legend handles - #1
Merged
Merged
Conversation
- diagram_box, diagram_arrow: labelled boxes and point-width arrows for flowcharts - flux_diagram, flux_legend: a box model's budget, arrows sign-aware and sqrt-scaled - profile(bands=...): a shaded range behind a profile in its colour - legend_handle: line, marker or band legend entries in the role_style vocabulary - data.box_budget, gallery example 33, guide sections, changelog
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.
Adds box-and-arrow diagrams and two small helpers.
diagram_box,diagram_arrow(new modulenicefigs.diagrams): a labelled rounded box, and a filled arrow whose shaft and head are sized in points, so drawings keep their shape on any aspect. Both are placed in data coordinates; arrows take aconnectionstylefor curves and an optional midpoint label. These are the pieces for flowcharts and schematics.flux_diagram: a box model's budget built from those pieces. It draws a grid of boxes (rows bottom first) coloured on a diverging norm. Fluxes arevertical,horizontal,lateral(drawn on both sides of a box, inward when positive) andground. Each arrow is sign-aware and its width is proportional to √|value|, on one scale per kind. Two further options:partssplits the vertical flux, andnotesadds a note to each box. Pass a sharednormandreferenceto compare panels. It returns(ax, FluxDiagram)with the mappable, the boxes and every arrow (tail, head, width).flux_legend: explains a diagram's encoding.profile(bands={name: (low, high)}): shades a range, such as an interquartile range, behind a profile in its colour.legend_handle(label, kind, **style): builds a line, marker or band legend entry in therole_stylevocabulary.data.box_budget: a closed example budget. Also adds gallery example 33, guide sections (Box-and-arrow diagrams, profile bands, styling), a changelog entry under[Unreleased], and 24 new tests.Motivation: torchtransport's CATRINE layer-budget figure and several schematics and flowcharts drew raw matplotlib patches. They will compose these primitives instead.
Checks:
pytest(505 passed),ruff check/ruff format --check(v0.15.0),scripts/docs_examples.py(0 problems), andmkdocs build --strict.No version bump and no tag. The release is cut separately.