8000 Deprecate unused "frac" key in annotate() arrowprops. by anntzer · Pull Request #26080 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Deprecate unused "frac" key in annotate() arrowprops. #26080

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

Merged
merged 1 commit into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/api/next_api_changes/deprecations/26780-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Support for passing the "frac" key in ``annotate(..., arrowprops={"frac": ...})``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... has been removed. This key has had no effect since Matplotlib 1.5.
11 changes: 5 additions & 6 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -1838,9 +1838,12 @@ def transform(renderer) -> Transform
self._arrow_relpos = arrowprops.pop("relpos", (0.5, 0.5))
else:
# modified YAArrow API to be used with FancyArrowPatch
for key in [
'width', 'headwidth', 'headlength', 'shrink', 'frac']:
for key in ['width', 'headwidth', 'headlength', 'shrink']:
arrowprops.pop(key, None)
if 'frac' in arrowprops:
_api.warn_deprecated(
"3.8", name="the (unused) 'frac' key in 'arrowprops'")
arrowprops.pop("frac")
self.arrow_patch = FancyArrowPatch((0, 0), (1, 1), **arrowprops)
else:
self.arrow_patch = None
Expand Down Expand Up @@ -1933,10 +1936,6 @@ def update_positions(self, renderer):
shrink = arrowprops.get('shrink', 0.0)
width = arrowprops.get('width', 4)
headwidth = arrowprops.get('headwidth', 12)
if 'frac' in arrowprops:
_api.warn_external(
"'frac' option in 'arrowprops' is no longer supported;"
" use 'headlength' to set the head length in points.")
headlength = arrowprops.get('headlength', 12)

# NB: ms is in pts
Expand Down
0