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

Skip to content

Commit 5ca283d

Browse files
authored
Merge pull request #7290 from anntzer/remove-deprecated-stuff
Remove deprecated stuff schedule for removal.
2 parents a00932e + 867d6f1 commit 5ca283d

File tree

9 files changed

+25
-141
lines changed

9 files changed

+25
-141
lines changed

doc/api/api_changes/code_removal.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,18 @@ via ``matplotlib.tri``
1010
qt4_compat.py
1111
-------------
1212
Moved to ``qt_compat.py``. Renamed because it now handles Qt5 as well.
13+
14+
15+
Deprecated methods
16+
------------------
17+
18+
The ``GraphicsContextBase.set_graylevel``, ``FigureCanvasBase.onHilite`` and
19+
``mpl_toolkits.axes_grid1.mpl_axes.Axes.toggle_axisline`` methods have been
20+
removed.
21+
22+
23+
`Axes.set_aspect("normal")`
24+
---------------------------
25+
26+
Support for setting an ``Axes``' aspect to ``"normal"`` has been removed, in
27+
favor of the synonym ``"auto"``.

examples/user_interfaces/embedding_in_qt4_wtoolbar.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
import sys
44

55
import numpy as np
6+
import matplotlib
7+
matplotlib.use("Qt4Agg")
68
from matplotlib.figure import Figure
79
from matplotlib.backend_bases import key_press_handler
810
from matplotlib.backends.backend_qt4agg import (
911
FigureCanvasQTAgg as FigureCanvas,
1012
NavigationToolbar2QT as NavigationToolbar)
11-
from matplotlib.backends import qt4_compat
12-
use_pyside = qt4_compat.QT_API == qt4_compat.QT_API_PYSIDE
13+
from matplotlib.backends import qt_compat
14+
use_pyside = qt_compat.QT_API == qt_compat.QT_API_PYSIDE
1315

1416
if use_pyside:
1517
from PySide.QtCore import *
@@ -70,5 +72,6 @@ def main():
7072
form.show()
7173
app.exec_()
7274

75+
7376
if __name__ == "__main__":
7477
main()

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,6 @@ def set_aspect(self, aspect, adjustable=None, anchor=None):
12271227
value description
12281228
======== ================================================
12291229
'auto' automatic; fill position rectangle with data
1230-
'normal' same as 'auto'; deprecated
12311230
'equal' same scaling from data to plot units for x and y
12321231
num a circle will be stretched such that the height
12331232
is num times the width. aspect=1 is the same as
@@ -1259,16 +1258,8 @@ def set_aspect(self, aspect, adjustable=None, anchor=None):
12591258
'SE' lower right corner
12601259
etc.
12611260
===== =====================
1262-
1263-
.. deprecated:: 1.2
1264-
the option 'normal' for aspect is deprecated. Use 'auto' instead.
12651261
"""
1266-
if aspect == 'normal':
1267-
cbook.warn_deprecated(
1268-
'1.2', name='normal', alternative='auto', obj_type='aspect')
1269-
self._aspect = 'auto'
1270-
1271-
elif aspect in ('equal', 'auto'):
1262+
if aspect in ('equal', 'auto'):
12721263
self._aspect = aspect
12731264
else:
12741265
self._aspect = float(aspect) # raise ValueError if necessary

lib/matplotlib/backend_bases.py

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,17 +1016,6 @@ def set_foreground(self, fg, isRGBA=False):
10161016
else:
10171017
self._rgb = colors.to_rgba(fg)
10181018

1019-
def set_graylevel(self, frac):
1020-
"""
1021-
Set the foreground color to be a gray level with *frac*
1022-
"""
1023-
# When removing, remember to remove all overrides in subclasses.
1024-
msg = ("set_graylevel is deprecated for removal in 1.6; "
1025-
"you can achieve the same result by using "
1026-
"set_foreground((frac, frac, frac))")
1027-
warnings.warn(msg, mplDeprecation)
1028-
self._rgb = (frac, frac, frac, self._alpha)
1029-
10301019
def set_joinstyle(self, js):
10311020
"""
10321021
Set the join style to be one of ('miter', 'round', 'bevel')
@@ -1727,53 +1716,6 @@ def onRemove(self, ev):
17271716
break
17281717
h = parent
17291718

1730-
def onHilite(self, ev):
1731-
"""
1732-
Mouse event processor which highlights the artists
1733-
under the cursor. Connect this to the 'motion_notify_event'
1734-
using::
1735-
1736-
canvas.mpl_connect('motion_notify_event',canvas.onHilite)
1737-
"""
1738-
msg = ("onHilite has been deprecated in 1.5 and will be removed "
1739-
"in 1.6. This function has not been used internally by mpl "
1740-
"since 2007.")
1741-
warnings.warn(msg, mplDeprecation)
1742-
if not hasattr(self, '_active'):
1743-
self._active = dict()
1744-
1745-
under = self.figure.hitlist(ev)
1746-
enter = [a for a in under if a not in self._active]
1747-
leave = [a for a in self._active if a not in under]
1748-
# On leave restore the captured colour
1749-
for a in leave:
1750-
if hasattr(a, 'get_color'):
1751-
a.set_color(self._active[a])
1752-
elif hasattr(a, 'get_edgecolor'):
1753-
a.set_edgecolor(self._active[a][0])
1754-
a.set_facecolor(self._active[a][1])
1755-
del self._active[a]
1756-
# On enter, capture the color and repaint the artist
1757-
# with the highlight colour. Capturing colour has to
1758-
# be done first in case the parent recolouring affects
1759-
# the child.
1760-
for a in enter:
1761-
if hasattr(a, 'get_color'):
1762-
self._active[a] = a.get_color()
1763-
elif hasattr(a, 'get_edgecolor'):
1764-
self._active[a] = (a.get_edgecolor(), a.get_facecolor())
1765-
else:
1766-
self._active[a] = None
1767-
for a in enter:
1768-
if hasattr(a, 'get_color'):
1769-
a.set_color('red')
1770-
elif hasattr(a, 'get_edgecolor'):
1771-
a.set_edgecolor('red')
1772-
a.set_facecolor('lightblue')
1773-
else:
1774-
self._active[a] = None
1775-
self.draw_idle()
1776-
17771719
def pick(self, mouseevent):
17781720
if not self.widgetlock.locked():
17791721
self.figure.pick(mouseevent)

lib/matplotlib/backends/backend_cairo.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,6 @@ def set_foreground(self, fg, isRGBA=None):
468468
else:
469469
self.ctx.set_source_rgba(*self._rgb)
470470

471-
def set_graylevel(self, frac):
472-
GraphicsContextBase.set_graylevel(self, frac)
473-
if len(self._rgb) == 3:
474-
self.ctx.set_source_rgb(*self._rgb)
475-
else:
476-
self.ctx.set_source_rgba(*self._rgb)
477-
478471
def get_rgb(self):
479472
return self.ctx.get_source().get_rgba()[:3]
480473

lib/matplotlib/backends/backend_gdk.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,6 @@ def set_foreground(self, fg, isRGBA=False):
394394
self.gdkGC.foreground = self.rgb_to_gdk_color(self.get_rgb())
395395

396396

397-
def set_graylevel(self, frac):
398-
GraphicsContextBase.set_graylevel(self, frac)
399-
self.gdkGC.foreground = self.rgb_to_gdk_color(self.get_rgb())
400-
401-
402397
def set_joinstyle(self, js):
403398
GraphicsContextBase.set_joinstyle(self, js)
404399
self.gdkGC.join_style = self._joind[self._joinstyle]

lib/matplotlib/backends/backend_wx.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -467,19 +467,6 @@ def set_foreground(self, fg, isRGBA=None):
467467
self.gfx_ctx.SetPen(self._pen)
468468
self.unselect()
469469

470-
def set_graylevel(self, frac):
471-
"""
472-
Set the foreground color. fg can be a matlab format string, a
473-
html hex color string, an rgb unit tuple, or a float between 0
474-
and 1. In the latter case, grayscale is used.
475-
"""
476-
DEBUG_MSG("set_graylevel()", 1, self)
477-
self.select()
478-
GraphicsContextBase.set_graylevel(self, frac)
479-
self._pen.SetColour(self.get_wxcolour(self.get_rgb()))
480-
self.gfx_ctx.SetPen(self._pen)
481-
self.unselect()
482-
483470
def set_linewidth(self, w):
484471
"""
485472
Set the line width.

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,16 @@
33

44
import six
55

6-
import matplotlib.cbook as cbook
7-
8-
import matplotlib.axes as maxes
9-
#import matplotlib.colorbar as mcolorbar
10-
from . import colorbar as mcolorbar
116
import matplotlib as mpl
12-
import matplotlib.patches as mpatches
7+
import matplotlib.axes as maxes
8+
import matplotlib.cbook as cbook
139
import matplotlib.lines as mlines
10+
import matplotlib.patches as mpatches
1411
import matplotlib.ticker as ticker
15-
1612
from matplotlib.gridspec import SubplotSpec
1713

1814
from .axes_divider import Size, SubplotDivider, LocatableAxes, Divider
15+
from .colorbar import Colorbar
1916

2017

2118
def _extend_axes_pad(value):
@@ -37,43 +34,6 @@ def _tick_only(ax, bottom_on, left_on):
3734
ax.axis["left"].toggle(ticklabels=left_off, label=left_off)
3835

3936

40-
class Colorbar(mcolorbar.Colorbar):
41-
def _config_axes_deprecated(self, X, Y):
42-
'''
43-
Make an axes patch and outline.
44-
'''
45-
ax = self.ax
46-
ax.set_frame_on(False)
47-
ax.set_navigate(False)
48-
xy = self._outline(X, Y)
49-
ax.update_datalim(xy)
50-
ax.set_xlim(*ax.dataLim.intervalx)
51-
ax.set_ylim(*ax.dataLim.intervaly)
52-
self.outline = mlines.Line2D(xy[:, 0], xy[:, 1],
53-
color=mpl.rcParams['axes.edgecolor'],
54-
linewidth=mpl.rcParams['axes.linewidth'])
55-
ax.add_artist(self.outline)
56-
self.outline.set_clip_box(None)
57-
self.outline.set_clip_path(None)
58-
c = mpl.rcParams['axes.facecolor']
59-
self.patch = mpatches.Polygon(xy, edgecolor=c,
60-
facecolor=c,
61-
linewidth=0.01,
62-
zorder=-1)
63-
ax.add_artist(self.patch)
64-
ticks, ticklabels, offset_string = self._ticker()
65-
66-
if self.orientation == 'vertical':
67-
ax.set_yticks(ticks)
68-
ax.set_yticklabels(ticklabels)
69-
ax.yaxis.get_major_formatter().set_offset_string(offset_string)
70-
71-
else:
72-
ax.set_xticks(ticks)
73-
ax.set_xticklabels(ticklabels)
74-
ax.xaxis.get_major_formatter().set_offset_string(offset_string)
75-
76-
7737
class CbarAxesBase(object):
7838

7939
def colorbar(self, mappable, **kwargs):

lib/mpl_toolkits/axes_grid1/mpl_axes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ def __call__(self, *kl, **kwargs):
2323

2424

2525
class Axes(maxes.Axes):
26-
def toggle_axisline(self, b):
27-
warnings.warn("toggle_axisline is not necessary and deprecated in axes_grid1")
2826

2927
class AxisDict(dict):
3028
def __init__(self, axes):

0 commit comments

Comments
 (0)