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

Skip to content

Commit f98c484

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 78aabc3 commit f98c484

File tree

3 files changed

+14
-41
lines changed

3 files changed

+14
-41
lines changed

doc/api/api_changes/code_removal.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,9 @@ only be valid values.
5252
Remove ``set_colorbar`` method from ``ScalarMappable``
5353
------------------------------------------------------
5454
Remove ``set_colorbar`` method, use `colorbar` attribute directly.
55+
56+
57+
patheffects.svg
58+
---------------
59+
- remove ``get_proxy_renderer`` method from ``AbstarctPathEffect`` class
60+
- remove ``patch_alpha`` and ``offset_xy`` from ``SimplePatchShadow``

lib/matplotlib/patheffects.py

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
import six
1111

1212
from matplotlib.backend_bases import RendererBase
13-
from matplotlib.backends.backend_mixed import MixedModeRenderer
1413
import matplotlib.transforms as mtransforms
15-
import matplotlib.cbook as cbook
1614
from matplotlib.colors import colorConverter
1715
import matplotlib.patches as mpatches
1816

@@ -42,12 +40,6 @@ def _offset_transform(self, renderer, transform):
4240
return transform + self._offset_trans.clear().translate(offset_x,
4341
offset_y)
4442

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-
5143
def _update_gc(self, gc, new_gc_dict):
5244
"""
5345
Update the given GraphicsCollection with the given
@@ -219,9 +211,9 @@ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
219211

220212
class SimplePatchShadow(AbstractPathEffect):
221213
"""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):
214+
def __init__(self, offset=(2, -2),
215+
shadow_rgbFace=None, alpha=None,
216+
rho=0.3, **kwargs):
225217
"""
226218
Parameters
227219
----------
@@ -241,24 +233,12 @@ def __init__(self, offset=(2,-2),
241233
:meth:`AbstractPathEffect._update_gc`.
242234
243235
"""
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
248236
super(SimplePatchShadow, self).__init__(offset)
249237

250238
if shadow_rgbFace is None:
251239
self._shadow_rgbFace = shadow_rgbFace
252240
else:
253241
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
262242

263243
if alpha is None:
264244
alpha = 0.3

lib/matplotlib/tests/test_patheffects.py

Lines changed: 5 additions & 18 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,11 +105,9 @@ def test_PathEffect_points_to_pixels():
116105
pe_renderer.points_to_pixels(15))
117106

118107

119-
def test_SimplePatchShadow_offset_xy():
120-
with mock.patch('matplotlib.cbook.deprecated') as dep:
121-
pe = path_effects.SimplePatchShadow(offset_xy=(4, 5))
108+
def test_SimplePatchShadow_offset():
109+
pe = path_effects.SimplePatchShadow(offset=(4, 5))
122110
assert_equal(pe._offset, (4, 5))
123-
dep.assert_called()
124111

125112

126113
@image_comparison(baseline_images=['collection'])

0 commit comments

Comments
 (0)
0