Skip to content

Add support for linewidth in legend frame parsing#653

Closed
K-Mirembe-Mercy wants to merge 204 commits intoUltraplot:mainfrom
K-Mirembe-Mercy:main
Closed

Add support for linewidth in legend frame parsing#653
K-Mirembe-Mercy wants to merge 204 commits intoUltraplot:mainfrom
K-Mirembe-Mercy:main

Conversation

@K-Mirembe-Mercy
Copy link

This PR adds support for linewidth and lw as aliases for controlling the legend frame edge width.

Previously, only edgewidth was supported. This improves usability and aligns behavior with matplotlib conventions.

Changes:

  • Updated _parse_frame() to accept linewidth and lw.

@cvanelteren
Copy link
Collaborator

Hi @K-Mirembe-Mercy. Good start but this doses not solve the issue yet. While parseframe now accepts the new keywords, we need to update the parts of the code so that it updates the frame.

You can have a look how that is performed for legend.geo. After the code is implemented (or before), we need to add unit tests that will ensure correctness of to e added code.
Hope this helps.

@cvanelteren
Copy link
Collaborator

The commit marked as 0 is also a bit curious. Could you restore it to the one before.

@K-Mirembe-Mercy
Copy link
Author

Thanks for the clarification! I’ve updated the handling so that "kw_frame" is no longer mutated when extracting specific kwargs. Frame properties like "linewidth" are now preserved and correctly applied via "legendPatch.update".

cvanelteren and others added 26 commits March 22, 2026 08:25
…raplot#408)

* fix: change default reduce_C_function to np.sum for hexbin

Updated default behavior for weights/C to compute total instead of average.

* test: add a test

---------

Co-authored-by: Casper van Elteren <caspervanelteren@gmail.com>
* add seaborn context processing

* rm debug

* add unittest

* resolve iterable

* relax legend filter

* add seaborn import

* add more unittests

* add ctx texts

* implement mark external and context managing

* fix test

* refactor classes for clarity

* update tests

* more fixes

* more tests

* minor fix

* minor fix

* fix for mpl 3.9

* remove stack frame

* adjust and remove unecessary tests

* more fixes

* add external to pass test

* restore test

* rm dup

* finalize docstring

* remove fallback

* Apply suggestion from @beckermr

* Apply suggestion from @beckermr

* fix bar and test

---------

Co-authored-by: Matthew R. Becker <beckermr@users.noreply.github.com>
…lot#415)

Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 5 to 6
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* init + tests

* restore stupid mistake

* Update ultraplot/figure.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update ultraplot/tests/test_legend.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update ultraplot/tests/test_legend.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update ultraplot/figure.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
It should be `formatter.zerotrim` not `format.zerotrim`.
* Fix references in documentation for clarity

Fix two unidenfined references in why.rst.
1. ug_apply_norm is a typo I think.
2. ug_mplrc. I'm not sure what it should be. Only by guess.

* keep apply_norm

---------

Co-authored-by: cvanelteren <caspervanelteren@gmail.com>
* add label rotation for geo

* add unittests for labelrotation

* black formatting

* more tests to increase coverage
…t#429)

* fix boundary check for ticks

* fix boundary test

* fix boundary test
…aplot#432)

* Fix GeoAxes panel alignment with aspect-constrained projections

Add _adjust_panel_positions() method to dynamically reposition panels after apply_aspect() shrinks the main GeoAxes to maintain projection aspect ratio. This ensures panels properly flank the visible map boundaries rather than remaining at their original gridspec positions, eliminating gaps between panels and the map when using large pad values or when the projection's aspect ratio differs significantly from the allocated subplot space.

* Fix double-adjustment issue in panel positioning

Remove _adjust_panel_positions() call from GeoAxes.draw() to prevent
double-adjustment. The method should only be called in
_CartopyAxes.get_tightbbox() where apply_aspect() happens and tight
layout calculations occur. This fixes the odd gap issue when saving
figures with top panels.

* Revert "Fix double-adjustment issue in panel positioning"

This reverts commit ef55f69.

* Fix panel gap calculation to use original positions

Use panel.get_position(original=True) instead of get_position() to
ensure gap calculations are based on original gridspec positions,
not previously adjusted positions. This makes _adjust_panel_positions()
idempotent and fixes accumulated adjustment errors when called multiple
times during the render/save cycle.

* Adjust tolerance in test_reference_aspect for floating-point precision

The reference width calculations have minor floating-point precision
differences (< 0.1%) which are expected. Update np.isclose() to use
rtol=1e-3 to account for this while still validating accuracy.

* Fix boundary label visibility issue in cartopy

Cartopy was hiding boundary labels due to floating point precision issues
when checking if labels are within the axes extent. The labels at exact
boundary values (e.g., 20°N when latlim=(20, 50)) were being marked invisible.

Solution:
1. Set gridliner xlim/ylim explicitly before drawing (cartopy >= 0.19)
2. Force boundary labels to be visible if their positions are within the
   axes extent, both in get_tightbbox() and draw() methods
3. Added _force_boundary_label_visibility() helper method

This fixes the test_boundary_labels_negative_longitude test which was failing
since it was added in commit d3f8342.

* Revert "Fix boundary label visibility issue in cartopy"

This reverts commit 794e7a5.

* Fix test_boundary_labels tests to match actual cartopy behavior

The test helper was checking total label count instead of visible labels,
and the negative longitude test expected a boundary label (20°N) to be
visible when cartopy actually hides it due to floating point precision.

Changes:
- Modified _check_boundary_labels() to check visible label count, not total
- Updated test_boundary_labels_negative_longitude to expect only the labels
  that are actually visible (35°N, 50°N) instead of all 3

This test was failing since it was first added in d3f8342.

* Remove _adjust_panel_positions call from GeoAxes.draw()

The method is only defined in _CartopyAxes, not _BasemapAxes, so calling
it from the base GeoAxes.draw() causes AttributeError for basemap axes.

The adjustment is only needed for cartopy's apply_aspect() behavior, so
it should only be called in _CartopyAxes.get_tightbbox() where it belongs.

* Override draw() in _CartopyAxes to adjust panel positions

Instead of calling _adjust_panel_positions() from base GeoAxes.draw()
(which breaks basemap), override draw() specifically in _CartopyAxes.
This ensures panel alignment works for cartopy while keeping basemap
compatibility.

* make subplots_adjust work with both backend

* Revert "make subplots_adjust work with both backend"

This reverts commit 800f983.

* this works but generates different sizes

* fix failing tests

* this fails locally but should pass on GHA

* Fix unequal slicing for Gridspec (Ultraplot#435)

* fix remaining issues

* dedup logic

* Dedup geo panel alignment logic
Bumps the github-actions group with 2 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/download-artifact](https://github.com/actions/download-artifact).


Updates `actions/upload-artifact` from 5 to 6
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v5...v6)

Updates `actions/download-artifact` from 6 to 7
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/download-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Apply dual-axis transform in data space

* Add regression test for dualx on log axes
…plot#440)

* Add subset label sharing groups

* Add subset label sharing tests

* Adjust geo subset label tests

* Limit implicit label sharing to subsets

* Expand subset label sharing coverage

* dedup logic
updates:
- [github.com/psf/black-pre-commit-mirror: 25.11.0 → 25.12.0](psf/black-pre-commit-mirror@25.11.0...25.12.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Shrink title to avoid abc overlap

* Skip title auto-scaling when fontsize is set

* Add tests for abc/title auto-scaling

* Fix title overlap tests and zero-size axes draw

* Shrink titles when abc overlaps across locations

* update tests

* re-add tests

* Clarify padding variable names in _update_title_position

Renamed local variables to better reflect their purpose:
- abcpad -> abc_title_sep_pts (abc-title separation in points)
- pad -> abc_title_sep (abc-title separation in axes coords)
- abc_pad -> abc_offset (user's horizontal offset in axes coords)

Added comprehensive inline comments explaining:
- The difference between abc-title separation (spacing when co-located)
  and abc offset (user's horizontal shift via abcpad parameter)
- Unit conversions from points to axes coordinates
- Source and purpose of each variable

Updated documentation:
- Enhanced abcpad parameter docstring to clarify it's a horizontal offset
- Added inline comments to instance variables at initialization

This addresses co-author feedback requesting clarification of the
relationship between abcpad, self._abc_pad, pad, and abc_pad variables.

No API changes - all modifications are internal refactoring only.
cvanelteren and others added 21 commits March 22, 2026 08:26
Use direct range filtering for candidate core versions so version checks work cleanly across major-version boundaries. Keep same-major arithmetic expansion only as a fallback, and add a regression test covering a 3.x to 4.x Matplotlib transition.
Teach Dependabot to monitor the project Python dependencies in pyproject.toml so Matplotlib and related package bumps are proposed automatically alongside the existing GitHub Actions updates.
…aplot#624)

Bumps the github-actions group with 1 update: [dorny/paths-filter](https://github.com/dorny/paths-filter).


Updates `dorny/paths-filter` from 3 to 4
- [Release notes](https://github.com/dorny/paths-filter/releases)
- [Changelog](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md)
- [Commits](dorny/paths-filter@v3...v4)

---
updated-dependencies:
- dependency-name: dorny/paths-filter
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Casper van Elteren <caspervanelteren@gmail.com>
* Add choropleth support to GeoAxes

* Use rc defaults for choropleth

* Move to docstring snippet manager

* Spelling error

* Overlay choropleth edges above borders
* Fix shared boxplot tick labels

* Document shared boxplot tick workaround

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Add custom labels to sizelegend

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Preserve rc['patch.linewidth'] for patch-style 2D artists when edgefix is active, and add targeted regressions for bar, hist, pie, and fill_between while leaving collection edgefix behavior unchanged.\n\nCloses Ultraplot#648
@cvanelteren
Copy link
Collaborator

@K-Mirembe-Mercy the history is dirty here, you need to rebase from main and include the tests in this PR -- no separate PR is necessary.

@K-Mirembe-Mercy
Copy link
Author

Thanks for the feedback! I’ve rebased from main and added tests to this PR.

I’ll resolve the remaining conflicts and update the branch shortly.

@K-Mirembe-Mercy
Copy link
Author

Closing this PR due to merge conflicts. I’ve opened a new clean PR with the same changes for easier review.

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.

6 participants