Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ba30477

Browse filesBrowse files
committed
Some PEP8 fixes for axes3d.py
1 parent 1521b44 commit ba30477
Copy full SHA for ba30477

File tree

Expand file treeCollapse file tree

1 file changed

+45
-35
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+45
-35
lines changed

‎lib/mpl_toolkits/mplot3d/axes3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axes3d.py
+45-35Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(self, fig, rect=None, *args, **kwargs):
5656
*sharez* Other axes to share z-limits with
5757
================ =========================================
5858
59-
.. versionadded :: 1.2.0
59+
.. versionadded :: 1.2.1
6060
*sharez*
6161
6262
''' % {'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()])}
@@ -65,8 +65,6 @@ def __init__(self, fig, rect=None, *args, **kwargs):
6565
rect = [0.0, 0.0, 1.0, 1.0]
6666
self._cids = []
6767

68-
# TODO: Support z-axis sharing
69-
7068
self.initial_azim = kwargs.pop('azim', -60)
7169
self.initial_elev = kwargs.pop('elev', 30)
7270
zscale = kwargs.pop('zscale', None)
@@ -125,22 +123,28 @@ def set_axis_on(self):
125123
self._axis3don = True
126124

127125
def have_units(self):
128-
'Return *True* if units are set on the *x*, *y*, or *z* axes'
126+
"""
127+
Return *True* if units are set on the *x*, *y*, or *z* axes
128+
129+
"""
129130
return (self.xaxis.have_units() or self.yaxis.have_units() or
130131
self.zaxis.have_units())
131132

132133
def convert_zunits(self, z):
133-
"""For artists in an axes, if the zaxis has units support,
134+
"""
135+
For artists in an axes, if the zaxis has units support,
134136
convert *z* using zaxis unit type
135137
136-
.. versionadded :: 1.2.0
138+
.. versionadded :: 1.2.1
139+
137140
"""
138141
return self.zaxis.convert_units(z)
139142

140143
def _process_unit_info(self, xdata=None, ydata=None, zdata=None,
141144
kwargs=None):
142145
"""
143146
Look for unit *kwargs* and update the axis instances as necessary
147+
144148
"""
145149
Axes._process_unit_info(self, xdata=xdata, ydata=ydata, kwargs=kwargs)
146150

@@ -154,8 +158,8 @@ def _process_unit_info(self, xdata=None, ydata=None, zdata=None,
154158

155159
# process kwargs 2nd since these will override default units
156160
if kwargs is not None:
157-
zunits = kwargs.pop( 'zunits', self.zaxis.units)
158-
if zunits!=self.zaxis.units:
161+
zunits = kwargs.pop('zunits', self.zaxis.units)
162+
if zunits != self.zaxis.units:
159163
self.zaxis.set_units(zunits)
160164
# If the units being set imply a different converter,
161165
# we need to update.
@@ -461,7 +465,7 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True,
461465
Function signature was changed to better match the 2D version.
462466
*tight* is now explicitly a kwarg and placed first.
463467
464-
.. versionchanged :: 1.2.0
468+
.. versionchanged :: 1.2.1
465469
This is now fully functional.
466470
467471
"""
@@ -551,12 +555,12 @@ def _determine_lims(self, xmin=None, xmax=None, *args, **kwargs):
551555
return (xmin, xmax)
552556

553557
def set_xlim3d(self, left=None, right=None, emit=True, auto=False, **kw):
554-
'''
558+
"""
555559
Set 3D x limits.
556560
557561
See :meth:`matplotlib.axes.Axes.set_xlim` for full documentation.
558562
559-
'''
563+
"""
560564
if 'xmin' in kw:
561565
left = kw.pop('xmin')
562566
if 'xmax' in kw:
@@ -565,7 +569,7 @@ def set_xlim3d(self, left=None, right=None, emit=True, auto=False, **kw):
565569
raise ValueError("unrecognized kwargs: %s" % kw.keys())
566570

567571
if right is None and iterable(left):
568-
left,right = left
572+
left, right = left
569573

570574
self._process_unit_info(xdata=(left, right))
571575
if left is not None:
@@ -574,13 +578,15 @@ def set_xlim3d(self, left=None, right=None, emit=True, auto=False, **kw):
574578
right = self.convert_xunits(right)
575579

576580
old_left, old_right = self.get_xlim()
577-
if left is None: left = old_left
578-
if right is None: right = old_right
581+
if left is None:
582+
left = old_left
583+
if right is None:
584+
right = old_right
579585

580-
if left==right:
586+
if left == right:
581587
warnings.warn(('Attempting to set identical left==right results\n'
582-
+ 'in singular transformations; automatically expanding.\n'
583-
+ 'left=%s, right=%s') % (left, right))
588+
'in singular transformations; automatically expanding.\n'
589+
'left=%s, right=%s') % (left, right))
584590
left, right = mtransforms.nonsingular(left, right, increasing=False)
585591
left, right = self.xaxis.limit_range_for_scale(left, right)
586592
self.xy_viewLim.intervalx = (left, right)
@@ -604,12 +610,12 @@ def set_xlim3d(self, left=None, right=None, emit=True, auto=False, **kw):
604610

605611

606612
def set_ylim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
607-
'''
613+
"""
608614
Set 3D y limits.
609615
610616
See :meth:`matplotlib.axes.Axes.set_ylim` for full documentation.
611617
612-
'''
618+
"""
613619
if 'ymin' in kw:
614620
bottom = kw.pop('ymin')
615621
if 'ymax' in kw:
@@ -618,7 +624,7 @@ def set_ylim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
618624
raise ValueError("unrecognized kwargs: %s" % kw.keys())
619625

620626
if top is None and iterable(bottom):
621-
bottom,top = bottom
627+
bottom, top = bottom
622628

623629
self._process_unit_info(ydata=(bottom, top))
624630
if bottom is not None:
@@ -627,13 +633,15 @@ def set_ylim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
627633
top = self.convert_yunits(top)
628634

629635
old_bottom, old_top = self.get_ylim()
630-
if bottom is None: bottom = old_bottom
631-
if top is None: top = old_top
636+
if bottom is None:
637+
bottom = old_bottom
638+
if top is None:
639+
top = old_top
632640

633-
if top==bottom:
641+
if top == bottom:
634642
warnings.warn(('Attempting to set identical bottom==top results\n'
635-
+ 'in singular transformations; automatically expanding.\n'
636-
+ 'bottom=%s, top=%s') % (bottom, top))
643+
'in singular transformations; automatically expanding.\n'
644+
'bottom=%s, top=%s') % (bottom, top))
637645
bottom, top = mtransforms.nonsingular(bottom, top, increasing=False)
638646
bottom, top = self.yaxis.limit_range_for_scale(bottom, top)
639647
self.xy_viewLim.intervaly = (bottom, top)
@@ -656,12 +664,12 @@ def set_ylim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
656664
set_ylim = set_ylim3d
657665

658666
def set_zlim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
659-
'''
667+
"""
660668
Set 3D z limits.
661669
662670
See :meth:`matplotlib.axes.Axes.set_ylim` for full documentation
663-
.
664-
'''
671+
672+
"""
665673
if 'zmin' in kw:
666674
bottom = kw.pop('zmin')
667675
if 'zmax' in kw:
@@ -670,7 +678,7 @@ def set_zlim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
670678
raise ValueError("unrecognized kwargs: %s" % kw.keys())
671679

672680
if top is None and iterable(bottom):
673-
bottom,top = bottom
681+
bottom, top = bottom
674682

675683
self._process_unit_info(zdata=(bottom, top))
676684
if bottom is not None:
@@ -679,13 +687,15 @@ def set_zlim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
679687
top = self.convert_zunits(top)
680688

681689
old_bottom, old_top = self.get_zlim()
682-
if bottom is None: bottom = old_bottom
683-
if top is None: top = old_top
690+
if bottom is None:
691+
bottom = old_bottom
692+
if top is None:
693+
top = old_top
684694

685-
if top==bottom:
695+
if top == bottom:
686696
warnings.warn(('Attempting to set identical bottom==top results\n'
687-
+ 'in singular transformations; automatically expanding.\n'
688-
+ 'bottom=%s, top=%s') % (bottom, top))
697+
'in singular transformations; automatically expanding.\n'
698+
'bottom=%s, top=%s') % (bottom, top))
689699
bottom, top = mtransforms.nonsingular(bottom, top, increasing=False)
690700
bottom, top = self.zaxis.limit_range_for_scale(bottom, top)
691701
self.zz_viewLim.intervalx = (bottom, top)
@@ -2149,7 +2159,7 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c='b', *args, **kwargs):
21492159
is_2d = False
21502160
art3d.patch_collection_2d_to_3d(patches, zs=zs, zdir=zdir)
21512161

2152-
if self._zmargin < 0.05 and xs.size > 0 :
2162+
if self._zmargin < 0.05 and xs.size > 0:
21532163
self.set_zmargin(0.05)
21542164

21552165
#FIXME: why is this necessary?

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.