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

Skip to content

Commit 6d4194f

Browse files
committed
Whitespace cleanup of axes3d.
1 parent 5768a53 commit 6d4194f

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import warnings
1919

20+
import numpy as np
2021
import matplotlib.axes as maxes
2122
from matplotlib.axes import Axes, rcParams
2223
from matplotlib import cbook
@@ -26,18 +27,19 @@
2627
from matplotlib import docstring
2728
import matplotlib.scale as mscale
2829
from matplotlib.tri.triangulation import Triangulation
29-
import numpy as np
3030
from matplotlib import colors as mcolors
3131
from matplotlib.colors import Normalize, LightSource
3232

3333
from . import art3d
3434
from . import proj3d
3535
from . import axis3d
3636

37+
3738
def unit_bbox():
3839
box = Bbox(np.array([[0, 0], [1, 1]]))
3940
return box
4041

42+
4143
class Axes3D(Axes):
4244
"""
4345
3D axes object.
@@ -302,7 +304,7 @@ def get_axis_position(self):
302304
def update_datalim(self, xys, **kwargs):
303305
pass
304306

305-
def get_autoscale_on(self) :
307+
def get_autoscale_on(self):
306308
"""
307309
Get whether autoscaling is applied for all axes on plot commands
308310
@@ -311,7 +313,7 @@ def get_autoscale_on(self) :
311313
"""
312314
return Axes.get_autoscale_on(self) and self.get_autoscalez_on()
313315

314-
def get_autoscalez_on(self) :
316+
def get_autoscalez_on(self):
315317
"""
316318
Get whether autoscaling for the z-axis is applied on plot commands
317319
@@ -320,7 +322,7 @@ def get_autoscalez_on(self) :
320322
"""
321323
return self._autoscaleZon
322324

323-
def set_autoscale_on(self, b) :
325+
def set_autoscale_on(self, b):
324326
"""
325327
Set whether autoscaling is applied on plot commands
326328
@@ -332,7 +334,7 @@ def set_autoscale_on(self, b) :
332334
Axes.set_autoscale_on(self, b)
333335
self.set_autoscalez_on(b)
334336

335-
def set_autoscalez_on(self, b) :
337+
def set_autoscalez_on(self, b):
336338
"""
337339
Set whether autoscaling for the z-axis is applied on plot commands
338340
@@ -343,7 +345,7 @@ def set_autoscalez_on(self, b) :
343345
"""
344346
self._autoscaleZon = b
345347

346-
def set_zmargin(self, m) :
348+
def set_zmargin(self, m):
347349
"""
348350
Set padding of Z data limits prior to autoscaling.
349351
@@ -360,7 +362,7 @@ def set_zmargin(self, m) :
360362
self._zmargin = m
361363
self.stale = True
362364

363-
def margins(self, *args, **kw) :
365+
def margins(self, *args, **kw):
364366
"""
365367
Convenience method to set or retrieve autoscaling margins.
366368
@@ -419,14 +421,14 @@ def margins(self, *args, **kw) :
419421
if mz is not None:
420422
self.set_zmargin(mz)
421423

422-
scalex = (mx is not None)
423-
scaley = (my is not None)
424-
scalez = (mz is not None)
424+
scalex = mx is not None
425+
scaley = my is not None
426+
scalez = mz is not None
425427

426428
self.autoscale_view(tight=tight, scalex=scalex, scaley=scaley,
427429
scalez=scalez)
428430

429-
def autoscale(self, enable=True, axis='both', tight=None) :
431+
def autoscale(self, enable=True, axis='both', tight=None):
430432
"""
431433
Convenience method for simple axis view autoscaling.
432434
See :meth:`matplotlib.axes.Axes.autoscale` for full explanation.
@@ -477,7 +479,7 @@ def auto_scale_xyz(self, X, Y, Z=None, had_data=None):
477479
self.autoscale_view()
478480

479481
def autoscale_view(self, tight=None, scalex=True, scaley=True,
480-
scalez=True) :
482+
scalez=True):
481483
"""
482484
Autoscale the view limits using the data limits.
483485
See :meth:`matplotlib.axes.Axes.autoscale_view` for documentation.
@@ -764,7 +766,7 @@ def get_zlim3d(self):
764766
return self.zz_viewLim.intervalx
765767
get_zlim = get_zlim3d
766768

767-
def get_zscale(self) :
769+
def get_zscale(self):
768770
"""
769771
Return the zaxis scale string %s
770772
@@ -775,7 +777,7 @@ def get_zscale(self) :
775777

776778
# We need to slightly redefine these to pass scalez=False
777779
# to their calls of autoscale_view.
778-
def set_xscale(self, value, **kwargs) :
780+
def set_xscale(self, value, **kwargs):
779781
self.xaxis._set_scale(value, **kwargs)
780782
self.autoscale_view(scaley=False, scalez=False)
781783
self._update_transScale()
@@ -786,7 +788,7 @@ def set_xscale(self, value, **kwargs) :
786788
This function was added, but not tested. Please report any bugs.
787789
"""
788790

789-
def set_yscale(self, value, **kwargs) :
791+
def set_yscale(self, value, **kwargs):
790792
self.yaxis._set_scale(value, **kwargs)
791793
self.autoscale_view(scalex=False, scalez=False)
792794
self._update_transScale()
@@ -799,7 +801,7 @@ def set_yscale(self, value, **kwargs) :
799801
"""
800802

801803
@docstring.dedent_interpd
802-
def set_zscale(self, value, **kwargs) :
804+
def set_zscale(self, value, **kwargs):
803805
"""
804806
Set the scaling of the z-axis: %(scale)s
805807
@@ -845,7 +847,7 @@ def get_zticks(self, minor=False):
845847
"""
846848
return self.zaxis.get_ticklocs(minor=minor)
847849

848-
def get_zmajorticklabels(self) :
850+
def get_zmajorticklabels(self):
849851
"""
850852
Get the ztick labels as a list of Text instances
851853
@@ -854,7 +856,7 @@ def get_zmajorticklabels(self) :
854856
return cbook.silent_list('Text zticklabel',
855857
self.zaxis.get_majorticklabels())
856858

857-
def get_zminorticklabels(self) :
859+
def get_zminorticklabels(self):
858860
"""
859861
Get the ztick labels as a list of Text instances
860862
@@ -867,7 +869,7 @@ def get_zminorticklabels(self) :
867869
return cbook.silent_list('Text zticklabel',
868870
self.zaxis.get_minorticklabels())
869871

870-
def set_zticklabels(self, *args, **kwargs) :
872+
def set_zticklabels(self, *args, **kwargs):
871873
"""
872874
Set z-axis tick labels.
873875
See :meth:`matplotlib.axes.Axes.set_yticklabels` for more details.
@@ -879,7 +881,7 @@ def set_zticklabels(self, *args, **kwargs) :
879881
"""
880882
return self.zaxis.set_ticklabels(*args, **kwargs)
881883

882-
def get_zticklabels(self, minor=False) :
884+
def get_zticklabels(self, minor=False):
883885
"""
884886
Get ztick labels as a list of Text instances.
885887
See :meth:`matplotlib.axes.Axes.get_yticklabels` for more details.
@@ -892,7 +894,7 @@ def get_zticklabels(self, minor=False) :
892894
return cbook.silent_list('Text zticklabel',
893895
self.zaxis.get_ticklabels(minor=minor))
894896

895-
def zaxis_date(self, tz=None) :
897+
def zaxis_date(self, tz=None):
896898
"""
897899
Sets up z-axis ticks and labels that treat the z data as dates.
898900
@@ -909,7 +911,7 @@ def zaxis_date(self, tz=None) :
909911
"""
910912
self.zaxis.axis_date(tz)
911913

912-
def get_zticklines(self) :
914+
def get_zticklines(self):
913915
"""
914916
Get ztick lines as a list of Line2D instances.
915917
Note that this function is provided merely for completeness.
@@ -1032,15 +1034,15 @@ def mouse_init(self, rotate_btn=1, zoom_btn=3):
10321034
self._rotate_btn = np.atleast_1d(rotate_btn).tolist()
10331035
self._zoom_btn = np.atleast_1d(zoom_btn).tolist()
10341036

1035-
def can_zoom(self) :
1037+
def can_zoom(self):
10361038
"""
10371039
Return *True* if this axes supports the zoom box button functionality.
10381040
10391041
3D axes objects do not use the zoom box button.
10401042
"""
10411043
return False
10421044

1043-
def can_pan(self) :
1045+
def can_pan(self):
10441046
"""
10451047
Return *True* if this axes supports the pan/zoom button functionality.
10461048
@@ -1199,7 +1201,7 @@ def set_zlabel(self, zlabel, fontdict=None, labelpad=None, **kwargs):
11991201
if labelpad is not None : self.zaxis.labelpad = labelpad
12001202
return self.zaxis.set_label_text(zlabel, fontdict, **kwargs)
12011203

1202-
def get_zlabel(self) :
1204+
def get_zlabel(self):
12031205
"""
12041206
Get the z-label text string.
12051207
@@ -1270,12 +1272,12 @@ def grid(self, b=True, **kwargs):
12701272
This function was changed, but not tested. Please report any bugs.
12711273
'''
12721274
# TODO: Operate on each axes separately
1273-
if len(kwargs) :
1275+
if len(kwargs):
12741276
b = True
12751277
self._draw_grid = cbook._string_to_bool(b)
12761278
self.stale = True
12771279

1278-
def ticklabel_format(self, **kwargs) :
1280+
def ticklabel_format(self, **kwargs):
12791281
"""
12801282
Convenience method for manipulating the ScalarFormatter
12811283
used by default for linear axes in Axed3D objects.
@@ -1338,7 +1340,7 @@ def ticklabel_format(self, **kwargs) :
13381340
raise AttributeError(
13391341
"This method only works with the ScalarFormatter.")
13401342

1341-
def locator_params(self, axis='both', tight=None, **kwargs) :
1343+
def locator_params(self, axis='both', tight=None, **kwargs):
13421344
"""
13431345
Convenience method for controlling tick locators.
13441346
@@ -1363,7 +1365,7 @@ def locator_params(self, axis='both', tight=None, **kwargs) :
13631365
self.zaxis.get_major_locator().set_params(**kwargs)
13641366
self.autoscale_view(tight=tight, scalex=_x, scaley=_y, scalez=_z)
13651367

1366-
def tick_params(self, axis='both', **kwargs) :
1368+
def tick_params(self, axis='both', **kwargs):
13671369
"""
13681370
Convenience method for changing the appearance of ticks and
13691371
tick labels.
@@ -1464,8 +1466,6 @@ def set_zbound(self, lower=None, upper=None):
14641466
else :
14651467
self.set_zlim(upper, lower, auto=None)
14661468

1467-
1468-
14691469
def text(self, x, y, z, s, zdir=None, **kwargs):
14701470
'''
14711471
Add text to the plot. kwargs will be passed on to Axes.text,
@@ -1653,7 +1653,7 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
16531653
for rs in xrange(0, rows-1, rstride):
16541654
for cs in xrange(0, cols-1, cstride):
16551655
ps = []
1656-
for a in (X, Y, Z) :
1656+
for a in (X, Y, Z):
16571657
ztop = a[rs,cs:min(cols, cs+cstride+1)]
16581658
zleft = a[rs+1:min(rows, rs+rstride+1),
16591659
min(cols-1, cs+cstride)]
@@ -1837,14 +1837,14 @@ def plot_wireframe(self, X, Y, Z, *args, **kwargs):
18371837
if rstride:
18381838
rii = list(xrange(0, rows, rstride))
18391839
# Add the last index only if needed
1840-
if rows > 0 and rii[-1] != (rows - 1) :
1840+
if rows > 0 and rii[-1] != (rows - 1):
18411841
rii += [rows-1]
18421842
else:
18431843
rii = []
18441844
if cstride:
18451845
cii = list(xrange(0, cols, cstride))
18461846
# Add the last index only if needed
1847-
if cols > 0 and cii[-1] != (cols - 1) :
1847+
if cols > 0 and cii[-1] != (cols - 1):
18481848
cii += [cols-1]
18491849
else:
18501850
cii = []
@@ -2060,9 +2060,9 @@ def add_contour_set(self, cset, extend3d=False, stride=5, zdir='z', offset=None)
20602060
z = offset
20612061
art3d.line_collection_2d_to_3d(linec, z, zdir=zdir)
20622062

2063-
def add_contourf_set(self, cset, zdir='z', offset=None) :
2063+
def add_contourf_set(self, cset, zdir='z', offset=None):
20642064
zdir = '-' + zdir
2065-
for z, linec in zip(cset.levels, cset.collections) :
2065+
for z, linec in zip(cset.levels, cset.collections):
20662066
if offset is not None :
20672067
z = offset
20682068
art3d.poly_collection_2d_to_3d(linec, z, zdir=zdir)

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ def test_lines_dists():
469469
ax.set_ylim(0, 300)
470470

471471

472+
472473
if __name__ == '__main__':
473474
import nose
474475
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)