Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c33e2ed

Browse files
committed
Remove axisartist deprecations.
1 parent 97c6864 commit c33e2ed

File tree

4 files changed

+28
-109
lines changed

4 files changed

+28
-109
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
``matplotlib.mlab``
22
~~~~~~~~~~~~~~~~~~~
33
``mlab.apply_window`` and ``mlab.stride_repeat`` have been removed.
4+
5+
axisartist
6+
~~~~~~~~~~
7+
``mpl_toolkits.axisartist.grid_finder.GridFinderBase`` has been removed; use
8+
`.GridFinder` instead.
9+
10+
``axisartist.axis_artist.BezierPath`` has been removed; use
11+
`.patches.PathPatch` instead.
12+
13+
Returning a factor equal to None from axisartist Locators (which are **not**
14+
the same as "standard" tick Locators), or passing a factor equal to None
15+
to axisartist Formatters (which are **not** the same as "standard" tick
16+
Formatters) is no longer supported. Pass a factor equal to 1 instead.

lib/mpl_toolkits/axisartist/axis_artist.py

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -99,90 +99,20 @@
9999
from matplotlib.patches import PathPatch
100100
from matplotlib.path import Path
101101
from matplotlib.transforms import (
102-
Affine2D, Bbox, IdentityTransform, ScaledTranslation, TransformedPath)
102+
Affine2D, Bbox, IdentityTransform, ScaledTranslation)
103103

104104
from .axisline_style import AxislineStyle
105105

106106

107-
@cbook.deprecated("3.2", alternative="matplotlib.patches.PathPatch")
108-
class BezierPath(Line2D):
109-
110-
def __init__(self, path, *args, **kwargs):
111-
"""
112-
Parameters
113-
----------
114-
path : `~.path.Path`
115-
The path to draw.
116-
**kwargs
117-
All remaining keyword arguments are passed to `.Line2D`.
118-
"""
119-
super().__init__([], [], *args, **kwargs)
120-
self._path = path
121-
self._invalid = False
122-
123-
def recache(self):
124-
self._transformed_path = TransformedPath(
125-
self._path, self.get_transform())
126-
self._invalid = False
127-
128-
def set_path(self, path):
129-
self._path = path
130-
self._invalid = True
131-
132-
def draw(self, renderer):
133-
if self._invalid:
134-
self.recache()
135-
136-
if not self._visible:
137-
return
138-
renderer.open_group('line2d', gid=self.get_gid())
139-
140-
gc = renderer.new_gc()
141-
self._set_gc_clip(gc)
142-
143-
gc.set_foreground(self._color)
144-
gc.set_antialiased(self._antialiased)
145-
gc.set_linewidth(self._linewidth)
146-
gc.set_alpha(self._alpha)
147-
if self.is_dashed():
148-
cap = self._dashcapstyle
149-
join = self._dashjoinstyle
150-
else:
151-
cap = self._solidcapstyle
152-
join = self._solidjoinstyle
153-
gc.set_joinstyle(join)
154-
gc.set_capstyle(cap)
155-
gc.set_dashes(self._dashOffset, self._dashSeq)
156-
157-
if self._lineStyles[self._linestyle] != '_draw_nothing':
158-
tpath, affine = (
159-
self._transformed_path.get_transformed_path_and_affine())
160-
renderer.draw_path(gc, tpath, affine.frozen())
161-
162-
gc.restore()
163-
renderer.close_group('line2d')
164-
165-
166107
class AttributeCopier:
167-
@cbook.deprecated("3.2")
168-
def __init__(self, ref_artist, klass=martist.Artist):
169-
self._klass = klass
170-
self._ref_artist = ref_artist
171-
super().__init__()
172-
173-
@cbook.deprecated("3.2")
174-
def set_ref_artist(self, artist):
175-
self._ref_artist = artist
176-
177108
def get_ref_artist(self):
178109
"""
179110
Return the underlying artist that actually defines some properties
180111
(e.g., color) of this artist.
181112
"""
182113
raise RuntimeError("get_ref_artist must overridden")
183114

184-
@cbook._delete_parameter("3.2", "default_value")
185-
def get_attribute_from_ref_artist(self, attr_name, default_value=None):
115+
def get_attribute_from_ref_artist(self, attr_name):
186116
getter = methodcaller("get_" + attr_name)
187117
prop = getter(super())
188118
return getter(self.get_ref_artist()) if prop == "auto" else prop

lib/mpl_toolkits/axisartist/grid_finder.py

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@
55
from .clip_path import clip_line_to_rect
66

77

8-
def _deprecate_factor_none(factor):
9-
# After the deprecation period, calls to _deprecate_factor_none can just be
10-
# removed.
11-
if factor is None:
12-
cbook.warn_deprecated(
13-
"3.2", message="factor=None is deprecated since %(since)s and "
14-
"support will be removed %(removal)s; use/return factor=1 instead")
15-
factor = 1
16-
return factor
17-
18-
198
class ExtremeFinderSimple:
209
"""
2110
A helper class to figure out the range of grid lines that need to be drawn.
@@ -110,8 +99,8 @@ def get_grid_info(self, x1, y1, x2, y2):
11099
lon_levs, lon_n, lon_factor = self.grid_locator1(lon_min, lon_max)
111100
lat_levs, lat_n, lat_factor = self.grid_locator2(lat_min, lat_max)
112101

113-
lon_values = lon_levs[:lon_n] / _deprecate_factor_none(lon_factor)
114-
lat_values = lat_levs[:lat_n] / _deprecate_factor_none(lat_factor)
102+
lon_values = lon_levs[:lon_n] / lon_factor
103+
lat_values = lat_levs[:lat_n] / lat_factor
115104

116105
lon_lines, lat_lines = self._get_raw_grid_lines(lon_values,
117106
lat_values,
@@ -218,19 +207,6 @@ def update(self, **kw):
218207
raise ValueError("Unknown update property '%s'" % k)
219208

220209

221-
@cbook.deprecated("3.2")
222-
class GridFinderBase(GridFinder):
223-
def __init__(self,
224-
extreme_finder,
225-
grid_locator1=None,
226-
grid_locator2=None,
227-
tick_formatter1=None,
228-
tick_formatter2=None):
229-
super().__init__((None, None), extreme_finder,
230-
grid_locator1, grid_locator2,
231-
tick_formatter1, tick_formatter2)
232-
233-
234210
class MaxNLocator(mticker.MaxNLocator):
235211
def __init__(self, nbins=10, steps=None,
236212
trim=True,
@@ -250,7 +226,7 @@ def __call__(self, v1, v2):
250226

251227
@cbook.deprecated("3.3")
252228
def set_factor(self, f):
253-
self._factor = _deprecate_factor_none(f)
229+
self._factor = f
254230

255231

256232
class FixedLocator:
@@ -265,7 +241,7 @@ def __call__(self, v1, v2):
265241

266242
@cbook.deprecated("3.3")
267243
def set_factor(self, f):
268-
self._factor = _deprecate_factor_none(f)
244+
self._factor = f
269245

270246

271247
# Tick Formatter

lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from matplotlib.transforms import Affine2D, IdentityTransform
1010
from .axislines import AxisArtistHelper, GridHelperBase
1111
from .axis_artist import AxisArtist
12-
from .grid_finder import GridFinder, _deprecate_factor_none
12+
from .grid_finder import GridFinder
1313

1414

1515
class FixedAxisArtistHelper(AxisArtistHelper.Fixed):
@@ -131,12 +131,12 @@ def update_lim(self, axes):
131131

132132
self.grid_info = {
133133
"extremes": (lon_min, lon_max, lat_min, lat_max),
134-
"lon_info": (lon_levs, lon_n, _deprecate_factor_none(lon_factor)),
135-
"lat_info": (lat_levs, lat_n, _deprecate_factor_none(lat_factor)),
134+
"lon_info": (lon_levs, lon_n, lon_factor),
135+
"lat_info": (lat_levs, lat_n, lat_factor),
136136
"lon_labels": grid_finder.tick_formatter1(
137-
"bottom", _deprecate_factor_none(lon_factor), lon_levs),
137+
"bottom", lon_factor, lon_levs),
138138
"lat_labels": grid_finder.tick_formatter2(
139-
"bottom", _deprecate_factor_none(lat_factor), lat_levs),
139+
"bottom", lat_factor, lat_levs),
140140
"line_xy": (xx, yy),
141141
}
142142

@@ -182,13 +182,13 @@ def get_tick_iterators(self, axes):
182182

183183
lat_levs, lat_n, lat_factor = self.grid_info["lat_info"]
184184
lat_levs = np.asarray(lat_levs)
185-
yy0 = lat_levs / _deprecate_factor_none(lat_factor)
186-
dy = 0.01 / _deprecate_factor_none(lat_factor)
185+
yy0 = lat_levs / lat_factor
186+
dy = 0.01 / lat_factor
187187

188188
lon_levs, lon_n, lon_factor = self.grid_info["lon_info"]
189189
lon_levs = np.asarray(lon_levs)
190-
xx0 = lon_levs / _deprecate_factor_none(lon_factor)
191-
dx = 0.01 / _deprecate_factor_none(lon_factor)
190+
xx0 = lon_levs / lon_factor
191+
dx = 0.01 / lon_factor
192192

193193
if None in self._extremes:
194194
e0, e1 = self._extremes

0 commit comments

Comments
 (0)