Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d3136e7

Browse filesBrowse files
committed
Deprecate public use of get_path_in_displaycoord.
It is a helper for FancyArrowPatch and ConnectionPatch, but no other Artists expose such a method, while the normal approach is just to apply `get_transform()` to `get_path()` (which is documented as an alternative). This may help future changes in the ArrowStyle API (e.g. allowing the tip and the body to have different linestyles).
1 parent 3c7a6f6 commit d3136e7
Copy full SHA for d3136e7

File tree

Expand file treeCollapse file tree

2 files changed

+16
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-10
lines changed
Open diff view settings
Collapse file
+4Lines changed: 4 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``FancyArrowPatch.get_path_in_displaycoord`` and ``ConnectionPath.get_path_in_displaycoord``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... are deprecated. The path in display coordinates can still be obtained, as
4+
for other patches, using ``patch.get_transform().transform_path(patch.get_path())``.
Collapse file

‎lib/matplotlib/patches.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4354,17 +4354,15 @@ def get_mutation_aspect(self):
43544354
else 1) # backcompat.
43554355

43564356
def get_path(self):
4357-
"""
4358-
Return the path of the arrow in the data coordinates. Use
4359-
get_path_in_displaycoord() method to retrieve the arrow path
4360-
in display coordinates.
4361-
"""
4362-
_path, fillable = self.get_path_in_displaycoord()
4357+
"""Return the path of the arrow in the data coordinates."""
4358+
# The path is generated in display coordinates, then converted back to
4359+
# data coordinates.
4360+
_path, fillable = self._get_path_in_displaycoord()
43634361
if np.iterable(fillable):
43644362
_path = Path.make_compound_path(*_path)
43654363
return self.get_transform().inverted().transform_path(_path)
43664364

4367-
def get_path_in_displaycoord(self):
4365+
def _get_path_in_displaycoord(self):
43684366
"""Return the mutated path of the arrow in display coordinates."""
43694367
dpi_cor = self._dpi_cor
43704368

@@ -4389,18 +4387,22 @@ def get_path_in_displaycoord(self):
43894387

43904388
return _path, fillable
43914389

4390+
get_path_in_displaycoord = _api.deprecate_privatize_attribute(
4391+
"3.5",
4392+
alternative="self.get_transform().transform_path(self.get_path())")
4393+
43924394
def draw(self, renderer):
43934395
if not self.get_visible():
43944396
return
43954397

43964398
with self._bind_draw_path_function(renderer) as draw_path:
43974399

43984400
# FIXME : dpi_cor is for the dpi-dependency of the linewidth. There
4399-
# could be room for improvement. Maybe get_path_in_displaycoord
4401+
# could be room for improvement. Maybe _get_path_in_displaycoord
44004402
# could take a renderer argument, but get_path should be adapted
44014403
# too.
44024404
self._dpi_cor = renderer.points_to_pixels(1.)
4403-
path, fillable = self.get_path_in_displaycoord()
4405+
path, fillable = self._get_path_in_displaycoord()
44044406

44054407
if not np.iterable(fillable):
44064408
path = [path]
@@ -4612,7 +4614,7 @@ def get_annotation_clip(self):
46124614
"""
46134615
return self._annotation_clip
46144616

4615-
def get_path_in_displaycoord(self):
4617+
def _get_path_in_displaycoord(self):
46164618
"""Return the mutated path of the arrow in display coordinates."""
46174619
dpi_cor = self._dpi_cor
46184620
posA = self._get_xy(self.xy1, self.coords1, self.axesA)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.