-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Replace ClabelText by set_transform_rotates_text. #24140
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
@@ -150,10 +151,8 @@ def clabel(self, levels=None, *, | |||
or minus 90 degrees from level. | |||
|
|||
use_clabeltext : bool, default: False |
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.
Should one consider renaming this argument?
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.
Makes sense. The kwarg can be renamed later (or now).
Let's defer that to another time. |
@@ -273,6 +272,7 @@ def get_label_width(self, lev, fmt, fsize): | |||
width *= 72 / fig.dpi | |||
return width | |||
|
|||
@_api.deprecated("3.7", alternative="Artist.set") |
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.
The deprecation is a bit terse
I think
labeler.set_label_props(label, text, color)
is equivalent to
label.set(text=text, color=color, fontproperties=labeler.labelFontProps, clip_box(labeler.axes)
Which is not quite straight forward unless you check the source. Can we document this better (even only in the changelog would be ok).
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.
sure, done.
ContourLabeler previously optionally used a custom Text subclass to ensure that text rotation took place in data space, not in screen space, but this is now available for all Text instances via the transform_rotates_text property, so directly use that. This means that _get_label_text, _add_label, and set_label_props can also directly get inlined into their now only callsite (add_label).
ContourLabeler previously optionally used a custom Text subclass to ensure that text rotation took place in data space, not in screen space, but this is now available for all Text instances via the transform_rotates_text property, so directly use that. This means that _get_label_text, _add_label, and set_label_props can also directly get inlined into their now only callsite (add_label).
PR Summary
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).