-
Notifications
You must be signed in to change notification settings - Fork 18
Avoid title overlap with abc labels #442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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! |
ultraplot/axes/base.py
Outdated
| width_inches = self._get_size_inches()[0] | ||
| pad = (abcpad / 72) / width_inches | ||
| abc_pad = (self._abc_pad / 72) / width_inches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
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
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.