feat: add rcParams for suptitle alignment (closes #24090)#31768
Open
RichardHopperProGrammar wants to merge 2 commits into
Open
feat: add rcParams for suptitle alignment (closes #24090)#31768RichardHopperProGrammar wants to merge 2 commits into
RichardHopperProGrammar wants to merge 2 commits into
Conversation
Add 'figure.titlehorizontalalign' and 'figure.titleverticalalign' rcParams so that users can control the default alignment of figure titles via rc settings. Before: Only fontsize and fontweight were configurable via rcParams; ha/va were hardcoded to 'center'/'top'. After: rcParams['figure.titlehorizontalalign'] defaults to 'center' rcParams['figure.titleverticalalign'] defaults to 'top' Explicit suptitle() kwargs still override rcParam defaults. - Added validate_suptitle_ha validator in rcsetup.py - Updated figure._suplabels to resolve ha/va from rcParams when set - Updated matplotlibrc with new default entries - Added 2 tests: rcParams alignment and kwarg override - Updated docstring to reference new rcParams
Use 'figure.title_horizontalalignment' and 'figure.title_verticalalignment' (per matplotlib#24090 discussion), matching matplotlib's naming convention with underscores for long rcParam names.
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
Add
figure.title_horizontalalignmentandfigure.title_verticalalignmentrcParams so that users can control the default alignment of figure titles via rc settings. Previously, only fontsize (figure.titlesize) and fontweight (figure.titleweight) were configurable via rcParams; horizontal/vertical alignment were hardcoded to"center"/"top".This PR addresses #24090 and uses the naming discussed in the issue:
figure.title_horizontalalignmentandfigure.title_verticalalignment(underscored per matplotlib convention).Proposed changes
validate_suptitle_havalidator + two new rcParam entries with defaults matching the old hardcoded values ("center"/"top")figure._suplabels()to resolve ha/va from rcParams when the key is set in theinfodictAdditional context
Backwards compatible — defaults match the old hardcoded values.