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

Skip to content

Remove deprecated stuff schedule for removal. #7290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc/api/api_changes/code_removal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,18 @@ via ``matplotlib.tri``
qt4_compat.py
-------------
Moved to ``qt_compat.py``. Renamed because it now handles Qt5 as well.


Deprecated methods
------------------

The ``GraphicsContextBase.set_graylevel``, ``FigureCanvasBase.onHilite`` and
``mpl_toolkits.axes_grid1.mpl_axes.Axes.toggle_axisline`` methods have been
removed.


`Axes.set_aspect("normal")`
---------------------------

Support for setting an ``Axes``' aspect to ``"normal"`` has been removed, in
favor of the synonym ``"auto"``.
7 changes: 5 additions & 2 deletions examples/user_interfaces/embedding_in_qt4_wtoolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import sys

import numpy as np
import matplotlib
matplotlib.use("Qt4Agg")
from matplotlib.figure import Figure
from matplotlib.backend_bases import key_press_handler
from matplotlib.backends.backend_qt4agg import (
FigureCanvasQTAgg as FigureCanvas,
NavigationToolbar2QT as NavigationToolbar)
from matplotlib.backends import qt4_compat
use_pyside = qt4_compat.QT_API == qt4_compat.QT_API_PYSIDE
from matplotlib.backends import qt_compat
use_pyside = qt_compat.QT_API == qt_compat.QT_API_PYSIDE

if use_pyside:
from PySide.QtCore import *
Expand Down Expand Up @@ -70,5 +72,6 @@ def main():
form.show()
app.exec_()


if __name__ == "__main__":
main()
11 changes: 1 addition & 10 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,6 @@ def set_aspect(self, aspect, adjustable=None, anchor=None):
value description
======== ================================================
'auto' automatic; fill position rectangle with data
'normal' same as 'auto'; deprecated
'equal' same scaling from data to plot units for x and y
num a circle will be stretched such that the height
is num times the width. aspect=1 is the same as
Expand Down Expand Up @@ -1259,16 +1258,8 @@ def set_aspect(self, aspect, adjustable=None, anchor=None):
'SE' lower right corner
etc.
===== =====================

.. deprecated:: 1.2
the option 'normal' for aspect is deprecated. Use 'auto' instead.
"""
if aspect == 'normal':
cbook.warn_deprecated(
'1.2', name='normal', alternative='auto', obj_type='aspect')
self._aspect = 'auto'

elif aspect in ('equal', 'auto'):
if aspect in ('equal', 'auto'):
self._aspect = aspect
else:
self._aspect = float(aspect) # raise ValueError if necessary
Expand Down
58 changes: 0 additions & 58 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,17 +1016,6 @@ def set_foreground(self, fg, isRGBA=False):
else:
self._rgb = colors.to_rgba(fg)

def set_graylevel(self, frac):
"""
Set the foreground color to be a gray level with *frac*
"""
# When removing, remember to remove all overrides in subclasses.
msg = ("set_graylevel is deprecated for removal in 1.6; "
"you can achieve the same result by using "
"set_foreground((frac, frac, frac))")
warnings.warn(msg, mplDeprecation)
self._rgb = (frac, frac, frac, self._alpha)

def set_joinstyle(self, js):
"""
Set the join style to be one of ('miter', 'round', 'bevel')
Expand Down Expand Up @@ -1727,53 +1716,6 @@ def onRemove(self, ev):
break
h = parent

def onHilite(self, ev):
"""
Mouse event processor which highlights the artists
under the cursor. Connect this to the 'motion_notify_event'
using::

canvas.mpl_connect('motion_notify_event',canvas.onHilite)
"""
msg = ("onHilite has been deprecated in 1.5 and will be removed "
"in 1.6. This function has not been used internally by mpl "
"since 2007.")
warnings.warn(msg, mplDeprecation)
if not hasattr(self, '_active'):
self._active = dict()

under = self.figure.hitlist(ev)
enter = [a for a in under if a not in self._active]
leave = [a for a in self._active if a not in under]
# On leave restore the captured colour
for a in leave:
if hasattr(a, 'get_color'):
a.set_color(self._active[a])
elif hasattr(a, 'get_edgecolor'):
a.set_edgecolor(self._active[a][0])
a.set_facecolor(self._active[a][1])
del self._active[a]
# On enter, capture the color and repaint the artist
# with the highlight colour. Capturing colour has to
# be done first in case the parent recolouring affects
# the child.
for a in enter:
if hasattr(a, 'get_color'):
self._active[a] = a.get_color()
elif hasattr(a, 'get_edgecolor'):
self._active[a] = (a.get_edgecolor(), a.get_facecolor())
else:
self._active[a] = None
for a in enter:
if hasattr(a, 'get_color'):
a.set_color('red')
elif hasattr(a, 'get_edgecolor'):
a.set_edgecolor('red')
a.set_facecolor('lightblue')
else:
self._active[a] = None
self.draw_idle()

def pick(self, mouseevent):
if not self.widgetlock.locked():
self.figure.pick(mouseevent)
Expand Down
7 changes: 0 additions & 7 deletions lib/matplotlib/backends/backend_cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,6 @@ def set_foreground(self, fg, isRGBA=None):
else:
self.ctx.set_source_rgba(*self._rgb)

def set_graylevel(self, frac):
GraphicsContextBase.set_graylevel(self, frac)
if len(self._rgb) == 3:
self.ctx.set_source_rgb(*self._rgb)
else:
self.ctx.set_source_rgba(*self._rgb)

def get_rgb(self):
return self.ctx.get_source().get_rgba()[:3]

Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/backends/backend_gdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,6 @@ def set_foreground(self, fg, isRGBA=False):
self.gdkGC.foreground = self.rgb_to_gdk_color(self.get_rgb())


def set_graylevel(self, frac):
GraphicsContextBase.set_graylevel(self, frac)
self.gdkGC.foreground = self.rgb_to_gdk_color(self.get_rgb())


def set_joinstyle(self, js):
GraphicsContextBase.set_joinstyle(self, js)
self.gdkGC.join_style = self._joind[self._joinstyle]
Expand Down
13 changes: 0 additions & 13 deletions lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,19 +467,6 @@ def set_foreground(self, fg, isRGBA=None):
self.gfx_ctx.SetPen(self._pen)
self.unselect()

def set_graylevel(self, frac):
"""
Set the foreground color. fg can be a matlab format string, a
html hex color string, an rgb unit tuple, or a float between 0
and 1. In the latter case, grayscale is used.
"""
DEBUG_MSG("set_graylevel()", 1, self)
self.select()
GraphicsContextBase.set_graylevel(self, frac)
self._pen.SetColour(self.get_wxcolour(self.get_rgb()))
self.gfx_ctx.SetPen(self._pen)
self.unselect()

def set_linewidth(self, w):
"""
Set the line width.
Expand Down
48 changes: 4 additions & 44 deletions lib/mpl_toolkits/axes_grid1/axes_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@

import six

import matplotlib.cbook as cbook

import matplotlib.axes as maxes
#import matplotlib.colorbar as mcolorbar
from . import colorbar as mcolorbar
import matplotlib as mpl
import matplotlib.patches as mpatches
import matplotlib.axes as maxes
import matplotlib.cbook as cbook
import matplotlib.lines as mlines
import matplotlib.patches as mpatches
import matplotlib.ticker as ticker

from matplotlib.gridspec import SubplotSpec

from .axes_divider import Size, SubplotDivider, LocatableAxes, Divider
from .colorbar import Colorbar


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


class Colorbar(mcolorbar.Colorbar):
def _config_axes_deprecated(self, X, Y):
'''
Make an axes patch and outline.
'''
ax = self.ax
ax.set_frame_on(False)
ax.set_navigate(False)
xy = self._outline(X, Y)
ax.update_datalim(xy)
ax.set_xlim(*ax.dataLim.intervalx)
ax.set_ylim(*ax.dataLim.intervaly)
self.outline = mlines.Line2D(xy[:, 0], xy[:, 1],
color=mpl.rcParams['axes.edgecolor'],
linewidth=mpl.rcParams['axes.linewidth'])
ax.add_artist(self.outline)
self.outline.set_clip_box(None)
self.outline.set_clip_path(None)
c = mpl.rcParams['axes.facecolor']
self.patch = mpatches.Polygon(xy, edgecolor=c,
facecolor=c,
linewidth=0.01,
zorder=-1)
ax.add_artist(self.patch)
ticks, ticklabels, offset_string = self._ticker()

if self.orientation == 'vertical':
ax.set_yticks(ticks)
ax.set_yticklabels(ticklabels)
ax.yaxis.get_major_formatter().set_offset_string(offset_string)

else:
ax.set_xticks(ticks)
ax.set_xticklabels(ticklabels)
ax.xaxis.get_major_formatter().set_offset_string(offset_string)


class CbarAxesBase(object):

def colorbar(self, mappable, **kwargs):
Expand Down
2 changes: 0 additions & 2 deletions lib/mpl_toolkits/axes_grid1/mpl_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ def __call__(self, *kl, **kwargs):


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

class AxisDict(dict):
def __init__(self, axes):
Expand Down