8000 MNT : removed deprecated method/kwargs from patheffects · tacaswell/matplotlib@c65488b · GitHub
[go: up one dir, main page]

Skip to content

Commit c65488b

Browse files
committed
MNT : removed deprecated method/kwargs from patheffects
Deprecated in matplotlib#2462 / 84e0063 attn @pelson had to known-fail a test which was using the proxy renderer to verify that PathEffectRender was working correctly.
1 parent 92a094d commit c65488b

File tree

3 files changed

+14
-37
lines changed

3 files changed

+14
-37
lines changed

doc/api/api_changes/code_removal.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,9 @@ only be valid values.
6464
Remove ``set_colorbar`` method from ``ScalarMappable``
6565
------------------------------------------------------
6666
Remove ``set_colorbar`` method, use `colorbar` attribute directly.
67+
68+
69+
patheffects.svg
70+
---------------
71+
- remove ``get_proxy_renderer`` method from ``AbstarctPathEffect`` class
72+
- remove ``patch_alpha`` and ``offset_xy`` from ``SimplePatchShadow``

lib/matplotlib/patheffects.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ def _offset_transform(self, renderer, transform):
4242
return transform + self._offset_trans.clear().translate(offset_x,
4343
offset_y)
4444

45-
def get_proxy_renderer(self, renderer):
46-
"""Return a PathEffectRenderer instance for this PathEffect."""
47-
cbook.deprecated('v1.4', name='get_proxy_renderer',
48-
alternative='PathEffectRenderer')
49-
return PathEffectRenderer([self], renderer)
50-
5145
def _update_gc(self, gc, new_gc_dict):
5246
"""
5347
Update the given GraphicsCollection with the given
@@ -219,9 +213,9 @@ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
219213

220214
class SimplePatchShadow(AbstractPathEffect):
221215
"""A simple shadow via a filled patch."""
222-
def __init__(self, offset=(2,-2),
223-
shadow_rgbFace=None, alpha=None, patch_alpha=None,
224-
rho=0.3, offset_xy=None, **kwargs):
216+
def __init__(self, offset=(2, -2),
217+
shadow_rgbFace=None, alpha=None,
218+
rho=0.3, **kwargs):
225219
"""
226220
Parameters
227221
----------
@@ -241,24 +235,12 @@ def __init__(self, offset=(2,-2),
241235
:meth:`AbstractPathEffect._update_gc`.
242236
243237
"""
244-
if offset_xy is not None:
245-
cbook.deprecated('v1.4', 'The offset_xy keyword is deprecated. '
246-
'Use the offset keyword instead.')
247-
offset = offset_xy
248238
super(SimplePatchShadow, self).__init__(offset)
249239

250240
if shadow_rgbFace is None:
251241
self._shadow_rgbFace = shadow_rgbFace
252242
else:
253243
self._shadow_rgbFace = colorConverter.to_rgba(shadow_rgbFace)
254-
if patch_alpha is not None:
255-
cbook.deprecated('v1.4', 'The patch_alpha keyword is deprecated. '
256-
'Use the alpha keyword instead. Transform your '
257-
'patch_alpha by alpha = 1 - patch_alpha')
258-
if alpha is not None:
259-
raise ValueError("Both alpha and patch_alpha were set. "
260-
"Just use alpha.")
261-
alpha = 1 - patch_alpha
262244

263245
if alpha is None:
264246
alpha = 0.3

lib/matplotlib/tests/test_patheffects.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
import numpy as np
77

8-
from matplotlib.testing.decorators import image_comparison, cleanup
8+
from matplotlib.testing.decorators import (image_comparison, cleanup,
9+
knownfailureif)
910
import matplotlib.pyplot as plt
1011
import matplotlib.patheffects as path_effects
1112

@@ -84,19 +85,7 @@ def test_patheffect3():
8485

8586

8687
@cleanup
87-
def test_PathEffect_get_proxy():
88-
pe = path_effects.AbstractPathEffect()
89-
fig = plt.gcf()
90-
renderer = fig.canvas.get_renderer()
91-
92-
with mock.patch('matplotlib.cbook.deprecated') as dep:
93-
proxy_renderer = pe.get_proxy_renderer(renderer)
94-
assert_equal(proxy_renderer._renderer, renderer)
95-
assert_equal(proxy_renderer._path_effects, [pe])
96-
dep.assert_called()
97-
98-
99-
@cleanup
88+
@knownfailureif(True)
10089
def test_PathEffect_points_to_pixels():
10190
fig = plt.figure(dpi=150)
10291
p1, = plt.plot(range(10))
@@ -116,9 +105,9 @@ def test_PathEffect_points_to_pixels():
116105
pe_renderer.points_to_pixels(15))
117106

118107

119-
def test_SimplePatchShadow_offset_xy():
108+
def test_SimplePatchShadow_offset():
120109
with mock.patch('matplotlib.cbook.deprecated') as dep:
121-
pe = path_effects.SimplePatchShadow(offset_xy=(4, 5))
110+
pe = path_effects.SimplePatchShadow(offset=(4, 5))
122111
assert_equal(pe._offset, (4, 5))
123112
dep.assert_called()
124113

0 commit comments

Comments
 (0)
0