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

Skip to content

changed inherited Axes calls to super #8486

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
Apr 19, 2017
Merged
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
50 changes: 26 additions & 24 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ def __init__(self, fig, rect=None, *args, **kwargs):
self._shared_z_axes.join(self, sharez)
self._adjustable = 'datalim'

Axes.__init__(self, fig, rect,
frameon=True,
*args, **kwargs)
super(Axes3D, self).__init__(fig, rect,
frameon=True,
*args, **kwargs)
# Disable drawing of axes by base class
Axes.set_axis_off(self)
super(Axes3D, self).set_axis_off()
# Enable drawing of axes by Axes3D class
self.set_axis_on()
self.M = None
Expand Down Expand Up @@ -159,7 +159,8 @@ def _process_unit_info(self, xdata=None, ydata=None, zdata=None,
Look for unit *kwargs* and update the axis instances as necessary

"""
Axes._process_unit_info(self, xdata=xdata, ydata=ydata, kwargs=kwargs)
super(Axes3D, self)._process_unit_info(xdata=xdata, ydata=ydata,
kwargs=kwargs)

if self.xaxis is None or self.yaxis is None or self.zaxis is None:
return
Expand Down Expand Up @@ -189,8 +190,8 @@ def set_top_view(self):

# This is purposely using the 2D Axes's set_xlim and set_ylim,
# because we are trying to place our viewing pane.
Axes.set_xlim(self, -xdwl, xdw, auto=None)
Axes.set_ylim(self, -ydwl, ydw, auto=None)
super(Axes3D, self).set_xlim(-xdwl, xdw, auto=None)
super(Axes3D, self).set_ylim(-ydwl, ydw, auto=None)

def _init_axis(self):
'''Init 3D axes; overrides creation of regular X/Y axes'''
Expand All @@ -208,7 +209,7 @@ def _init_axis(self):
ax.init3d()

def get_children(self):
return [self.zaxis, ] + Axes.get_children(self)
return [self.zaxis, ] + super(Axes3D, self).get_children()

def _get_axis_list(self):
return super(Axes3D, self)._get_axis_list() + (self.zaxis, )
Expand Down Expand Up @@ -293,7 +294,7 @@ def draw(self, renderer):
ax.draw(renderer)

# Then rest
Axes.draw(self, renderer)
super(Axes3D, self).draw(renderer)

def get_axis_position(self):
vals = self.get_w_lims()
Expand All @@ -313,7 +314,7 @@ def get_autoscale_on(self):
.. versionadded :: 1.1.0
This function was added, but not tested. Please report any bugs.
"""
return Axes.get_autoscale_on(self) and self.get_autoscalez_on()
return super(Axes3D, self).get_autoscale_on() and self.get_autoscalez_on()

def get_autoscalez_on(self):
"""
Expand All @@ -333,7 +334,7 @@ def set_autoscale_on(self, b):
.. versionadded :: 1.1.0
This function was added, but not tested. Please report any bugs.
"""
Axes.set_autoscale_on(self, b)
super(Axes3D, self).set_autoscale_on(b)
self.set_autoscalez_on(b)

def set_autoscalez_on(self, b):
Expand Down Expand Up @@ -1076,7 +1077,7 @@ def cla(self):
# Disabling mouse interaction might have been needed a long
# time ago, but I can't find a reason for it now - BVR (2012-03)
#self.disable_mouse_rotation()
Axes.cla(self)
super(Axes3D, self).cla()
self.zaxis.cla()

if self._sharez is not None:
Expand All @@ -1095,7 +1096,6 @@ def cla(self):
self._autoscaleZon = True
self._zmargin = 0


self.grid(rcParams['axes3d.grid'])

def disable_mouse_rotation(self):
Expand Down Expand Up @@ -1415,7 +1415,7 @@ def tick_params(self, axis='both', **kwargs):
.. versionadded :: 1.1.0
This function was added, but not tested. Please report any bugs.
"""
Axes.tick_params(self, axis, **kwargs)
super(Axes3D, self).tick_params(axis, **kwargs)
if axis in ['z', 'both'] :
zkw = dict(kwargs)
zkw.pop('top', None)
Expand Down Expand Up @@ -1495,7 +1495,7 @@ def text(self, x, y, z, s, zdir=None, **kwargs):
except for the `zdir` keyword, which sets the direction to be
used as the z direction.
'''
text = Axes.text(self, x, y, s, **kwargs)
text = super(Axes3D, self).text(x, y, s, **kwargs)
art3d.text_2d_to_3d(text, z, zdir)
return text

Expand Down Expand Up @@ -1538,7 +1538,7 @@ def plot(self, xs, ys, *args, **kwargs):
if not cbook.iterable(zs):
zs = np.ones(len(xs)) * zs

lines = Axes.plot(self, xs, ys, *args, **kwargs)
lines = super(Axes3D, self).plot(xs, ys, *args, **kwargs)
for line in lines:
art3d.line_2d_to_3d(line, zs=zs, zdir=zdir)

Expand Down Expand Up @@ -2107,7 +2107,7 @@ def contour(self, X, Y, Z, *args, **kwargs):
had_data = self.has_data()

jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
cset = Axes.contour(self, jX, jY, jZ, *args, **kwargs)
cset = super(Axes3D, self).contour(jX, jY, jZ, *args, **kwargs)
self.add_contour_set(cset, extend3d, stride, zdir, offset)

self.auto_scale_xyz(X, Y, Z, had_data)
Expand Down Expand Up @@ -2164,7 +2164,7 @@ def tricontour(self, *args, **kwargs):
jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
tri = Triangulation(jX, jY, tri.triangles, tri.mask)

cset = Axes.tricontour(self, tri, jZ, *args, **kwargs)
cset = super(Axes3D, self).tricontour(tri, jZ, *args, **kwargs)
self.add_contour_set(cset, extend3d, stride, zdir, offset)

self.auto_scale_xyz(X, Y, Z, had_data)
Expand Down Expand Up @@ -2199,7 +2199,7 @@ def contourf(self, X, Y, Z, *args, **kwargs):
had_data = self.has_data()

jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
cset = Axes.contourf(self, jX, jY, jZ, *args, **kwargs)
cset = super(Axes3D, self).contourf(jX, jY, jZ, *args, **kwargs)
self.add_contourf_set(cset, zdir, offset)

self.auto_scale_xyz(X, Y, Z, had_data)
Expand Down Expand Up @@ -2251,7 +2251,7 @@ def tricontourf(self, *args, **kwargs):
jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
tri = Triangulation(jX, jY, tri.triangles, tri.mask)

cset = Axes.tricontourf(self, tri, jZ, *args, **kwargs)
cset = super(Axes3D, self).tricontourf(tri, jZ, *args, **kwargs)
self.add_contourf_set(cset, zdir, offset)

self.auto_scale_xyz(X, Y, Z, had_data)
Expand Down Expand Up @@ -2288,7 +2288,7 @@ def add_collection3d(self, col, zs=0, zdir='z'):
art3d.patch_collection_2d_to_3d(col, zs=zs, zdir=zdir)
col.set_sort_zpos(zsortval)

Axes.add_collection(self, col)
super(Axes3D, self).add_collection(col)

def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,
*args, **kwargs):
Expand Down Expand Up @@ -2347,7 +2347,8 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,

xs, ys, zs, s, c = cbook.delete_masked_points(xs, ys, zs, s, c)

patches = Axes.scatter(self, xs, ys, s=s, c=c, *args, **kwargs)
patches = super(Axes3D, self).scatter(xs, ys, s=s, c=c, *args,
**kwargs)
if not cbook.iterable(zs):
is_2d = True
zs = np.ones(len(xs)) * zs
Expand Down Expand Up @@ -2389,7 +2390,7 @@ def bar(self, left, height, zs=0, zdir='z', *args, **kwargs):

had_data = self.has_data()

patches = Axes.bar(self, left, height, *args, **kwargs)
patches = super(Axes3D, self).bar(left, height, *args, **kwargs)

if not cbook.iterable(zs):
zs = np.ones(len(left)) * zs
Expand Down Expand Up @@ -2564,7 +2565,8 @@ def bar3d(self, x, y, z, dx, dy, dz, color=None,
return col

def set_title(self, label, fontdict=None, loc='center', **kwargs):
ret = Axes.set_title(self, label, fontdict=fontdict, loc=loc, **kwargs)
ret = super(Axes3D, self).set_title(label, fontdict=fontdict, loc=loc,
**kwargs)
(x, y) = self.title.get_position()
self.title.set_y(0.92 * y)
return ret
Expand Down