Feature: semantic legend API and geo legend support#586
Open
cvanelteren wants to merge 18 commits intomainfrom
Open
Feature: semantic legend API and geo legend support#586cvanelteren wants to merge 18 commits intomainfrom
cvanelteren wants to merge 18 commits intomainfrom
Conversation
Move semantic legends into Axes and UltraLegend methods: ax.cat_legend, ax.size_legend, ax.num_legend, ax.geo_legend. Route these methods through Axes.legend so shorthand legend locations (for example loc=r) work consistently.\n\nAdd rc-backed semantic defaults under legend.cat.*, legend.size.*, legend.num.*, and legend.geo.*.\n\nExpand geo legend behavior with country_reso (10m/50m/110m), country_territories toggle, country_proj support (name/CRS/callable), and per-entry tuple overrides for projections/options.\n\nImprove country shorthand handling for legends by preserving nearby islands while pruning far territories by default, with explicit opt-in to include far territories.\n\nAdd regression and feature tests covering shorthand locations, rc defaults, country resolution/projection passthrough, geometry handling, and semantic legend smoke behavior. Legend test suite passes locally.
Add a dedicated semantic legends section to the colorbars/legends guide with working examples for ax.cat_legend, ax.size_legend, ax.num_legend, and ax.geo_legend. The geo example now demonstrates generic polygons, country shorthand, and per-entry tuple overrides for country projection/resolution options. Also clean up the narrative text and convert the snippet into executable notebook cells.
a31cab1 to
ffaaea1
Compare
Collaborator
|
Seems that cat_legend, size_legend, num_legend, geo_legend take |
Collaborator
Author
|
Agreed. The paths look a bit funky with the default |
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.
This PR combines the #570/#571 groundwork into a user-facing semantic legend API on Axes (cat_legend, size_legend, num_legend, geo_legend) and wires defaults through rc so behavior is configurable consistently. It also adds geometry-aware legend handling (including country shorthand, projection/resolution/territory controls, and unified handle sizing), plus tests to cover shorthand loc behavior and geo legend rendering paths.