Conversation
The legend API now accepts a title_kw dict for passing arbitrary Text
properties to the legend title (e.g. title_kw={'style': 'italic'}),
consistent with the existing handle_kw parameter for handle styling.
This change also fixes a pre-existing bug where titlefontweight and
titlefontcolor were accepted by the API and silently stored but never
actually applied to the legend title Text object — they now take effect
as expected.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Regression is not related to the PR. I will need to think if this is a correct fixas we do list this property in the docs but it did not exist since ProPlot times. I ran into this problem when wanting to align the title, but this can be achieved through |
There was a problem hiding this comment.
Pull request overview
Implements support for passing arbitrary matplotlib.text.Text properties to the legend title via a new title_kw keyword, completing the intended feature from #656 and adding tests/docs to lock in the behavior.
Changes:
- Add
title_kwplumbing through legend input resolution and style application so title text properties can be set/overridden. - Ensure
title_kwoverridestitlefontweight/titlefontcolorwhen both are provided (merge order). - Add unit tests and update legend-parameter documentation to cover
title_kw.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
ultraplot/legend.py |
Adds title_kw to normalized inputs and applies merged title text styling to legend titles. |
ultraplot/axes/base.py |
Documents title_kw and forwards it through _add_legend to the legend implementation. |
ultraplot/tests/test_legend.py |
Adds focused tests validating title_kw behavior and override precedence vs. titlefont*. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Somehow this was not implemented.
Continuation of #656 after messing with claude a bit (new to it).