Skip to content

Commit 1bbbed8

Browse files
committed
STY: whitespace
1 parent aba96bc commit 1bbbed8

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

lib/matplotlib/pyplot.py

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,19 @@
6767
MaxNLocator
6868
from matplotlib.backends import pylab_setup
6969

70-
## Backend detection ##
70+
71+
# # Backend detection ##
7172
def _backend_selection():
7273
""" If rcParams['backend_fallback'] is true, check to see if the
7374
current backend is compatible with the current running event
7475
loop, and if not switches to a compatible one.
7576
"""
7677
backend = rcParams['backend']
77-
if not rcParams['backend_fallback'] or \
78-
backend not in _interactive_bk:
78+
if not (rcParams['backend_fallback'] or
79+
backend not in _interactive_bk):
7980
return
8081
is_agg_backend = rcParams['backend'].endswith('Agg')
81-
if 'wx' in sys.modules and not backend in ('WX', 'WXAgg'):
82+
if 'wx' in sys.modules and backend not in ('WX', 'WXAgg'):
8283
import wx
8384
if wx.App.IsMainLoopRunning():
8485
rcParams['backend'] = 'wx' + 'Agg' * is_agg_backend
@@ -676,7 +677,8 @@ def close(*args):
676677
elif isinstance(arg, Figure):
677678
_pylab_helpers.Gcf.destroy_fig(arg)
678679
else:
679-
raise TypeError('Unrecognized argument type %s to close' % type(arg))
680+
raise TypeError(
681+
'Unrecognized argument type %s to close' % type(arg))
680682
else:
681683
raise TypeError('close takes 0 or 1 arguments')
682684

@@ -806,13 +808,14 @@ def figlegend(*args, **kwargs):
806808
return fig.legend(*args, **kwargs)
807809

808810

809-
## Figure and Axes hybrid ##
811+
# # Figure and Axes hybrid ##
810812

811813
_hold_msg = """pyplot.hold is deprecated.
812814
Future behavior will be consistent with the long-time default:
813815
plot commands add elements without first clearing the
814816
Axes and/or Figure."""
815817

818+
816819
@deprecated("2.0", message=_hold_msg)
817820
def hold(b=None):
818821
"""
@@ -847,6 +850,7 @@ def hold(b=None):
847850
# a second warning, but "Oh, well...".
848851
rc('axes', hold=b)
849852

853+
850854
@deprecated("2.0", message=_hold_msg)
851855
def ishold():
852856
"""
@@ -874,6 +878,7 @@ def over(func, *args, **kwargs):
874878
func(*args, **kwargs)
875879
ax._hold = h
876880

881+
877882
## Axes ##
878883

879884

@@ -1025,7 +1030,8 @@ def subplot(*args, **kwargs):
10251030
# first, the plot (and its axes) previously created, will be removed
10261031
plt.subplot(211)
10271032
plt.plot(range(12))
1028-
plt.subplot(212, facecolor='y') # creates 2nd subplot with yellow background
1033+
# creates 2nd subplot with yellow background
1034+
plt.subplot(212, facecolor='y')
10291035
10301036
If you do not want this behavior, use the
10311037
:meth:`~matplotlib.figure.Figure.add_subplot` method or the
@@ -1062,16 +1068,16 @@ def subplot(*args, **kwargs):
10621068
10631069
"""
10641070
# if subplot called without arguments, create subplot(1,1,1)
1065-
if len(args)==0:
1066-
args=(1,1,1)
1071+
if len(args) == 0:
1072+
args = (1, 1, 1)
10671073

10681074
# This check was added because it is very easy to type
10691075
# subplot(1, 2, False) when subplots(1, 2, False) was intended
10701076
# (sharex=False, that is). In most cases, no error will
10711077
# ever occur, but mysterious behavior can result because what was
10721078
# intended to be the sharex argument is instead treated as a
10731079
# subplot index for subplot()
1074-
if len(args) >= 3 and isinstance(args[2], bool) :
1080+
if len(args) >= 3 and isinstance(args[2], bool):
10751081
warnings.warn("The subplot index argument to subplot() appears"
10761082
" to be a boolean. Did you intend to use subplots()?")
10771083

@@ -1080,10 +1086,12 @@ def subplot(*args, **kwargs):
10801086
bbox = a.bbox
10811087
byebye = []
10821088
for other in fig.axes:
1083-
if other==a: continue
1089+
if other == a:
1090+
continue
10841091
if bbox.fully_overlaps(other.bbox):
10851092
byebye.append(other)
1086-
for ax in byebye: delaxes(ax)
1093+
for ax in byebye:
1094+
delaxes(ax)
10871095

10881096
return a
10891097

@@ -1259,7 +1267,7 @@ def twinx(ax=None):
12591267
For an example
12601268
"""
12611269
if ax is None:
1262-
ax=gca()
1270+
ax = gca()
12631271
ax1 = ax.twinx()
12641272
return ax1
12651273

@@ -1272,7 +1280,7 @@ def twiny(ax=None):
12721280
returned.
12731281
"""
12741282
if ax is None:
1275-
ax=gca()
1283+
ax = gca()
12761284
ax1 = ax.twiny()
12771285
return ax1
12781286

@@ -1678,24 +1686,23 @@ def yticks(*args, **kwargs):
16781686
"""
16791687
ax = kwargs.pop('ax', gca())
16801688

1681-
if len(args)==0:
1689+
if len(args) == 0:
16821690
locs = ax.get_yticks()
16831691
labels = ax.get_yticklabels()
1684-
elif len(args)==1:
1692+
elif len(args) == 1:
16851693
locs = ax.set_yticks(args[0])
16861694
labels = ax.get_yticklabels()
1687-
elif len(args)==2:
1695+
elif len(args) == 2:
16881696
locs = ax.set_yticks(args[0])
16891697
labels = ax.set_yticklabels(args[1], **kwargs)
1690-
else: raise TypeError('Illegal number of arguments to yticks')
1698+
else:
1699+
raise TypeError('Illegal number of arguments to yticks')
16911700
if len(kwargs):
16921701
for l in labels:
16931702
l.update(kwargs)
16941703

1695-
1696-
return ( locs,
1697-
silent_list('Text yticklabel', labels)
1698-
)
1704+
return (locs,
1705+
silent_list('Text yticklabel', labels))
16991706

17001707

17011708
def minorticks_on(ax=None):

0 commit comments

Comments
 (0)