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

Skip to content

Commit 8943757

Browse files
committed
Merge pull request #1568 from NelleV/remove_deprecated_stuff
removed deprecated methods from the axes module.
2 parents 8ea6241 + 107530d commit 8943757

File tree

1 file changed

+39
-102
lines changed

1 file changed

+39
-102
lines changed

lib/matplotlib/axes.py

Lines changed: 39 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -139,25 +139,6 @@ def _process_plot_format(fmt):
139139
return linestyle, marker, color
140140

141141

142-
def set_default_color_cycle(clist):
143-
"""
144-
Change the default cycle of colors that will be used by the plot
145-
command. This must be called before creating the
146-
:class:`Axes` to which it will apply; it will
147-
apply to all future axes.
148-
149-
*clist* is a sequence of mpl color specifiers.
150-
151-
See also: :meth:`~matplotlib.axes.Axes.set_color_cycle`.
152-
153-
.. Note:: Deprecated 2010/01/03.
154-
Set rcParams['axes.color_cycle'] directly.
155-
156-
"""
157-
rcParams['axes.color_cycle'] = clist
158-
warnings.warn("Set rcParams['axes.color_cycle'] directly", mplDeprecation)
159-
160-
161142
class _process_plot_var_args(object):
162143
"""
163144
Process variable length arguments to the plot command, so that
@@ -282,12 +263,11 @@ def _makefill(self, x, y, kw, kwargs):
282263
facecolor = kw['color']
283264
except KeyError:
284265
facecolor = self.color_cycle.next()
285-
seg = mpatches.Polygon(np.hstack(
286-
(x[:, np.newaxis], y[:, np.newaxis])),
287-
facecolor=facecolor,
288-
fill=True,
289-
closed=kw['closed']
290-
)
266+
seg = mpatches.Polygon(np.hstack((x[:, np.newaxis],
267+
y[:, np.newaxis])),
268+
facecolor=facecolor,
269+
fill=True,
270+
closed=kw['closed'])
291271
self.set_patchprops(seg, **kwargs)
292272
return seg
293273

@@ -586,9 +566,9 @@ def _set_lim_and_transforms(self):
586566
self.transData = self.transScale + (self.transLimits + self.transAxes)
587567

588568
self._xaxis_transform = mtransforms.blended_transform_factory(
589-
self.transData, self.transAxes)
569+
self.transData, self.transAxes)
590570
self._yaxis_transform = mtransforms.blended_transform_factory(
591-
self.transAxes, self.transData)
571+
self.transAxes, self.transData)
592572

593573
def get_xaxis_transform(self, which='grid'):
594574
"""
@@ -1067,11 +1047,16 @@ def set_aspect(self, aspect, adjustable=None, anchor=None):
10671047
etc.
10681048
===== =====================
10691049
1050+
.. deprecated:: 1.2
1051+
the option 'normal' for aspect is deprecated. Use 'auto' instead.
10701052
"""
1071-
if aspect in ('normal', 'auto'):
1053+
if aspect == 'normal':
1054+
warnings.warn("Use 'auto' instead of 'normal' for aspect. Will "
1055+
"be removed in 1.4.x", mplDeprecation)
10721056
self._aspect = 'auto'
1073-
elif aspect == 'equal':
1074-
self._aspect = 'equal'
1057+
1058+
elif aspect in ('equal', 'auto'):
1059+
self._aspect = aspect
10751060
else:
10761061
self._aspect = float(aspect) # raise ValueError if necessary
10771062

@@ -1370,14 +1355,6 @@ def axis(self, *v, **kwargs):
13701355

13711356
return v
13721357

1373-
def get_child_artists(self):
1374-
"""
1375-
Return a list of artists the axes contains.
1376-
1377-
.. deprecated:: 0.98
1378-
"""
1379-
raise mplDeprecation('Use get_children instead')
1380-
13811358
def get_frame(self):
13821359
"""Return the axes Rectangle frame"""
13831360
warnings.warn('use ax.patch instead', mplDeprecation)
@@ -3108,30 +3085,6 @@ def set_cursor_props(self, *args):
31083085
c = mcolors.colorConverter.to_rgba(c)
31093086
self._cursorProps = lw, c
31103087

3111-
def connect(self, s, func):
3112-
"""
3113-
Register observers to be notified when certain events occur. Register
3114-
with callback functions with the following signatures. The function
3115-
has the following signature::
3116-
3117-
func(ax) # where ax is the instance making the callback.
3118-
3119-
The following events can be connected to:
3120-
3121-
'xlim_changed','ylim_changed'
3122-
3123-
The connection id is is returned - you can use this with
3124-
disconnect to disconnect from the axes event
3125-
3126-
"""
3127-
raise mplDeprecation('use the callbacks CallbackRegistry instance '
3128-
'instead')
3129-
3130-
def disconnect(self, cid):
3131-
"""disconnect from the Axes event."""
3132-
raise mplDeprecation('use the callbacks CallbackRegistry instance '
3133-
'instead')
3134-
31353088
def get_children(self):
31363089
"""return a list of child artists"""
31373090
children = []
@@ -3180,9 +3133,6 @@ def pick(self, *args):
31803133
each child artist will fire a pick event if mouseevent is over
31813134
the artist and the artist has picker set
31823135
"""
3183-
if len(args) > 1:
3184-
raise mplDeprecation('New pick API implemented -- '
3185-
'see API_CHANGES in the src distribution')
31863136
martist.Artist.pick(self, args[0])
31873137

31883138
### Labelling
@@ -3679,10 +3629,6 @@ def hlines(self, y, xmin, xmax, colors='k', linestyles='solid',
36793629
36803630
.. plot:: mpl_examples/pylab_examples/hline_demo.py
36813631
"""
3682-
if kwargs.get('fmt') is not None:
3683-
raise mplDeprecation('hlines now uses a '
3684-
'collections.LineCollection and not a '
3685-
'list of Line2D to draw; see API_CHANGES')
36863632

36873633
# We do the conversion first since not all unitized data is uniform
36883634
# process the unit information
@@ -3761,11 +3707,6 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
37613707
%(LineCollection)s
37623708
"""
37633709

3764-
if kwargs.get('fmt') is not None:
3765-
raise mplDeprecation('vlines now uses a '
3766-
'collections.LineCollection and not a '
3767-
'list of Line2D to draw; see API_CHANGES')
3768-
37693710
self._process_unit_info(xdata=x, ydata=[ymin, ymax], kwargs=kwargs)
37703711

37713712
# We do the conversion first since not all unitized data is uniform
@@ -4476,7 +4417,8 @@ def legend(self, *args, **kwargs):
44764417
instance. If *prop* is a dictionary, a new instance will be
44774418
created with *prop*. If *None*, use rc settings.
44784419
4479-
*fontsize*: [ size in points | 'xx-small' | 'x-small' | 'small' | 'medium' | 'large' | 'x-large' | 'xx-large' ]
4420+
*fontsize*: [size in points | 'xx-small' | 'x-small' | 'small' |
4421+
'medium' | 'large' | 'x-large' | 'xx-large']
44804422
Set the font size. May be either a size string, relative to
44814423
the default font size, or an absolute font size in points. This
44824424
argument is only used if prop is not specified.
@@ -5498,7 +5440,6 @@ def xywhere(xs, ys, mask):
54985440
if 'zorder' in kwargs:
54995441
plot_kw['zorder'] = kwargs['zorder']
55005442

5501-
55025443
if xerr is not None:
55035444
if (iterable(xerr) and len(xerr) == 2 and
55045445
iterable(xerr[0]) and iterable(xerr[1])):
@@ -5970,9 +5911,8 @@ def dopatch(xs, ys):
59705911

59715912
@docstring.dedent_interpd
59725913
def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
5973-
vmin=None, vmax=None, alpha=None, linewidths=None,
5974-
faceted=True, verts=None,
5975-
**kwargs):
5914+
vmin=None, vmax=None, alpha=None, linewidths=None,
5915+
verts=None, **kwargs):
59765916
"""
59775917
Make a scatter plot.
59785918
@@ -6095,13 +6035,16 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
60956035
else:
60966036
colors = mcolors.colorConverter.to_rgba_array(c, alpha)
60976037

6098-
if faceted:
6099-
edgecolors = None
6100-
else:
6101-
edgecolors = 'none'
6102-
warnings.warn(
6103-
'''replace "faceted=False" with "edgecolors='none'"''',
6104-
mplDeprecation) # 2008/04/18
6038+
faceted = kwargs.pop('faceted', None)
6039+
edgecolors = kwargs.get('edgecolors', None)
6040+
if faceted is not None:
6041+
warnings.warn("The faceted option is deprecated. "
6042+
"Please use edgecolor instead. Will "
6043+
"be remove in 1.4", mplDeprecation)
6044+
if faceted:
6045+
edgecolors = None
6046+
else:
6047+
edgecolors = 'none'
61056048

61066049
# to be API compatible
61076050
if marker is None and not (verts is None):
@@ -6615,9 +6558,10 @@ def arrow(self, x, y, dx, dy, **kwargs):
66156558
Draws arrow on specified axis from (*x*, *y*) to (*x* + *dx*,
66166559
*y* + *dy*). Uses FancyArrow patch to construct the arrow.
66176560
6618-
The resulting arrow is affected by the axes aspect ratio and limits. This
6619-
may produce an arrow whose head is not square with its stem. To create
6620-
an arrow whose head is square with its stem, use :meth:`annotate`.
6561+
The resulting arrow is affected by the axes aspect ratio and limits.
6562+
This may produce an arrow whose head is not square with its stem. To
6563+
create an arrow whose head is square with its stem, use
6564+
:meth:`annotate`.
66216565
66226566
Optional kwargs control the arrow construction and properties:
66236567
@@ -7319,6 +7263,9 @@ def pcolor(self, *args, **kwargs):
73197263
cmap = kwargs.pop('cmap', None)
73207264
vmin = kwargs.pop('vmin', None)
73217265
vmax = kwargs.pop('vmax', None)
7266+
if 'shading' in kwargs:
7267+
warnings.warn("Use edgecolors instead of shading. "
7268+
"Will be removed in 1.4", mplDeprecation)
73227269
shading = kwargs.pop('shading', 'flat')
73237270

73247271
X, Y, C = self._pcolorargs('pcolor', *args)
@@ -7367,6 +7314,7 @@ def pcolor(self, *args, **kwargs):
73677314
edgecolors = 'k',
73687315
else:
73697316
edgecolors = 'none'
7317+
73707318
if 'edgecolor' in kwargs:
73717319
kwargs['edgecolors'] = kwargs.pop('edgecolor')
73727320
ec = kwargs.setdefault('edgecolors', edgecolors)
@@ -7893,8 +7841,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
78937841
Either an integer number of bins or a sequence giving the
78947842
bins. If *bins* is an integer, *bins* + 1 bin edges
78957843
will be returned, consistent with :func:`numpy.histogram`
7896-
for numpy version >= 1.3, and with the *new* = True argument
7897-
in earlier versions.
7844+
for numpy version >= 1.3.
78987845
Unequally spaced bins are supported if *bins* is a sequence.
78997846
79007847
*range*:
@@ -8035,11 +7982,6 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
80357982
raise ValueError(
80367983
"orientation kwarg %s is not recognized" % orientation)
80377984

8038-
if kwargs.get('width') is not None:
8039-
raise mplDeprecation(
8040-
'hist now uses the rwidth to give relative width '
8041-
'and not absolute width')
8042-
80437985
if histtype == 'barstacked' and not stacked:
80447986
stacked = True
80457987

@@ -8124,8 +8066,6 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
81248066
# We will handle the normed kwarg within mpl until we
81258067
# get to the point of requiring numpy >= 1.5.
81268068
hist_kwargs = dict(range=bin_range)
8127-
if np.__version__ < "1.3": # version 1.1 and 1.2
8128-
hist_kwargs['new'] = True
81298069

81308070
n = []
81318071
mlast = bottom
@@ -8185,6 +8125,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
81858125

81868126
if align == 'mid' or align == 'edge':
81878127
boffset += 0.5 * totwidth
8128+
81888129
elif align == 'right':
81898130
boffset += totwidth
81908131

@@ -8767,10 +8708,6 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
87678708
:func:`~matplotlib.pyplot.plot`
87688709
For plotting options
87698710
"""
8770-
if precision is None:
8771-
precision = 0
8772-
warnings.warn("Use precision=0 instead of None", mplDeprecation)
8773-
# 2008/10/03
87748711
if marker is None and markersize is None and hasattr(Z, 'tocoo'):
87758712
marker = 's'
87768713
if marker is None and markersize is None:

0 commit comments

Comments
 (0)