8000 Merge pull request #20428 from anntzer/gpid · matplotlib/matplotlib@91016d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 91016d8

Browse files
authored
Merge pull request #20428 from anntzer/gpid
Deprecate public use of get_path_in_displaycoord.
2 parents f9bb47e + d3136e7 commit 91016d8

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed
Lines changed: 4 additions & 0 deletions
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())``.

lib/matplotlib/patches.py

Lines 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