Avoid title overlap with abc labels#442
Merged
Merged
Conversation
Collaborator
Author
|
There is no real issue that closes this, more an issue I run into sometimes where the titles will overlap with the labels. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
beckermr
requested changes
Jan 6, 2026
Comment on lines
+3049
to
+3051
| width_inches = self._get_size_inches()[0] | ||
| pad = (abcpad / 72) / width_inches | ||
| abc_pad = (self._abc_pad / 72) / width_inches |
Collaborator
There was a problem hiding this comment.
Please
-
leave a comment on the difference between abcpad, sel._abc_pad, pad, and abc_pad.
-
Rename the variables to better match their usage and meaning.
I get the unit conversion, but I don't understand what each variable means, what they are used for, and where they come from.
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.
13ca379 to
e76e2a7
Compare
beckermr
approved these changes
Jan 7, 2026
cvanelteren
added a commit
that referenced
this pull request
Jan 16, 2026
* 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.
K-Mirembe-Mercy
pushed a commit
to K-Mirembe-Mercy/UltraPlot
that referenced
this pull request
Mar 22, 2026
* 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.
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 avoids title overlap with a‑b‑c labels when both are placed in the same location. During draw, it measures the rendered widths of the two texts and, if needed, scales the title font down to fit within the available horizontal space for left, right, and centered alignments. The change is localized to
_update_title_position, so it only affects shared‑location titles and leaves other title behavior unchanged.