Skip to content

Commit 7fd177b

Browse files
authored
Merge pull request #17751 from anntzer/dpi_cor
Deprecate dpi_cor property of FancyArrowPatch.
2 parents 1f2d424 + 1843a48 commit 7fd177b

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
Deprecations
22
------------
3+
4+
``dpi_cor`` property of `.FancyArrowPatch`
5+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6+
This parameter is considered internal and deprecated.

lib/matplotlib/patches.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3829,6 +3829,7 @@ def __str__(self):
38293829
return f"{type(self).__name__}({self._path_original})"
38303830

38313831
@docstring.dedent_interpd
3832+
@cbook._delete_parameter("3.4", "dpi_cor")
38323833
def __init__(self, posA=None, posB=None,
38333834
path=None,
38343835
arrowstyle="simple",
@@ -3897,7 +3898,7 @@ def __init__(self, posA=None, posB=None,
38973898
38983899
dpi_cor : float, default: 1
38993900
dpi_cor is currently used for linewidth-related things and shrink
3900-
factor. Mutation scale is affected by this.
3901+
factor. Mutation scale is affected by this. Deprecated.
39013902
39023903
Other Parameters
39033904
----------------
@@ -3939,8 +3940,9 @@ def __init__(self, posA=None, posB=None,
39393940
self._mutation_scale = mutation_scale
39403941
self._mutation_aspect = mutation_aspect
39413942

3942-
self.set_dpi_cor(dpi_cor)
3943+
self._dpi_cor = dpi_cor
39433944

3945+
@cbook.deprecated("3.4")
39443946
def set_dpi_cor(self, dpi_cor):
39453947
"""
39463948
dpi_cor is currently used for linewidth-related things and
@@ -3953,6 +3955,7 @@ def set_dpi_cor(self, dpi_cor):
39533955
self._dpi_cor = dpi_cor
39543956
self.stale = True
39553957

3958+
@cbook.deprecated("3.4")
39563959
def get_dpi_cor(self):
39573960
"""
39583961
dpi_cor is currently used for linewidth-related things and
@@ -4118,7 +4121,7 @@ def get_path(self):
41184121

41194122
def get_path_in_displaycoord(self):
41204123
"""Return the mutated path of the arrow in display coordinates."""
4121-
dpi_cor = self.get_dpi_cor()
4124+
dpi_cor = self._dpi_cor
41224125

41234126
if self._posA_posB is not None:
41244127
posA = self._convert_xy_units(self._posA_posB[0])
@@ -4151,8 +4154,10 @@ def draw(self, renderer):
41514154
with self._bind_draw_path_function(renderer) as draw_path:
41524155

41534156
# FIXME : dpi_cor is for the dpi-dependency of the linewidth. There
4154-
# could be room for improvement.
4155-
self.set_dpi_cor(renderer.points_to_pixels(1.))
4157+
# could be room for improvement. Maybe get_path_in_displaycoord
4158+
# could take a renderer argument, but get_path should be adapted
4159+
# too.
4160+
self._dpi_cor = renderer.points_to_pixels(1.)
41564161
path, fillable = self.get_path_in_displaycoord()
41574162

41584163
if not np.iterable(fillable):
@@ -4175,6 +4180,7 @@ def __str__(self):
41754180
(self.xy1[0], self.xy1[1], self.xy2[0], self.xy2[1])
41764181

41774182
@docstring.dedent_interpd
4183+
@cbook._delete_parameter("3.4", "dpi_cor")
41784184
def __init__(self, xyA, xyB, coordsA, coordsB=None,
41794185
axesA=None, axesB=None,
41804186
arrowstyle="-",
@@ -4269,8 +4275,8 @@ def __init__(self, xyA, xyB, coordsA, coordsB=None,
42694275
mutation_scale=mutation_scale,
42704276
mutation_aspect=mutation_aspect,
42714277
clip_on=clip_on,
4272-
dpi_cor=dpi_cor,
42734278
**kwargs)
4279+
self._dpi_cor = dpi_cor
42744280

42754281
# if True, draw annotation only if self.xy is inside the axes
42764282
self._annotation_clip = None
@@ -4352,7 +4358,7 @@ def get_annotation_clip(self):
43524358

43534359
def get_path_in_displaycoord(self):
43544360
"""Return the mutated path of the arrow in display coordinates."""
4355-
dpi_cor = self.get_dpi_cor()
4361+
dpi_cor = self._dpi_cor
43564362
posA = self._get_xy(self.xy1, self.coords1, self.axesA)
43574363
posB = self._get_xy(self.xy2, self.coords2, self.axesB)
43584364
path = self.get_connectionstyle()(

0 commit comments

Comments
 (0)