8000 Merge pull request #17750 from anntzer/mutation_aspect · matplotlib/matplotlib@b35a5e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit b35a5e9

Browse files
authored
Merge pull request #17750 from anntzer/mutation_aspect
API: Soft-deprecate mutation_aspect=None.
2 parents 31fe463 + a8c2b01 commit b35a5e9

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

lib/matplotlib/patches.py

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,11 +2892,11 @@ def __call__(self, path, mutation_size, linewidth,
28922892
path_shrunk = Path(vertices, path.codes)
28932893
# call transmute method with squeezed height.
28942894
path_mutated, fillable = self.transmute(path_shrunk,
2895-
linewidth,
2896-
mutation_size)
2895+
mutation_size,
2896+
linewidth)
28972897
if np.iterable(fillable):
28982898
path_list = []
2899-
for p in zip(path_mutated):
2899+
for p in path_mutated:
29002900
# Restore the height
29012901
path_list.append(
29022902
Path(p.vertices * [1, aspect_ratio], p.codes))
@@ -3565,10 +3565,8 @@ def __str__(self):
35653565

35663566
@docstring.dedent_interpd
35673567
def __init__(self, xy, width, height,
3568-
boxstyle="round",
3569-
bbox_transmuter=None,
3570-
mutation_scale=1.,
3571-
mutation_aspect=None,
3568+
boxstyle="round", bbox_transmuter=None,
3569+
mutation_scale=1, mutation_aspect=1,
35723570
**kwargs):
35733571
"""
35743572
Parameters
@@ -3597,7 +3595,7 @@ def __init__(self, xy, width, height,
35973595
Scaling factor applied to the attributes of the box style
35983596
(e.g. pad or rounding_size).
35993597
3600-
mutation_aspect : float, optional
3598+
mutation_aspect : float, default: 1
36013599
The height of the rectangle will be squeezed by this value before
36023600
the mutation and the mutated box will be stretched by the inverse
36033601
of it. For example, this allows different horizontal and vertical
@@ -3703,7 +3701,8 @@ def set_mutation_aspect(self, aspect):
37033701

37043702
def get_mutation_aspect(self):
37053703
"""Return the aspect ratio of the bbox mutation."""
3706-
return self._mutation_aspect
3704+
return (self._mutation_aspect if self._mutation_aspect is not None
3705+
else 1) # backcompat.
37073706

37083707
def get_boxstyle(self):
37093708
"""Return the boxstyle object."""
@@ -3830,16 +3829,11 @@ def __str__(self):
38303829

38313830
@docstring.dedent_interpd
38323831
@cbook._delete_parameter("3.4", "dpi_cor")
3833-
def __init__(self, posA=None, posB=None,
3834-
path=None,
3835-
arrowstyle="simple",
3836-
connectionstyle="arc3",
3837-
patchA=None,
3838-
patchB=None,
3839-
shrinkA=2,
3840-
shrinkB=2,
3841-
mutation_scale=1,
3842-
mutation_aspect=None,
3832+
def __init__(self, posA=None, posB=None, path=None,
3833+
arrowstyle="simple", connectionstyle="arc3",
3834+
patchA=None, patchB=None,
3835+
shrinkA=2, shrinkB=2,
3836+
mutation_scale=1, mutation_aspect=1,
38433837
dpi_cor=1,
38443838
**kwargs):
38453839
"""
@@ -4106,7 +4100,8 @@ def set_mutation_aspect(self, aspect):
41064100

41074101
def get_mutation_aspect(self):
41084102
"""Return the aspect ratio of the bbox mutation."""
4109-
return self._mutation_aspect
4103+
return (self._mutation_aspect if self._mutation_aspect is not None
4104+
else 1) # backcompat.
41104105

41114106
def get_path(self):
41124107
"""

0 commit comments

Comments
 (0)
0