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

Skip to content

Commit eabc143

Browse files
committed
STY: white space clean up
- white space clean up - removed dead (commented out) code
1 parent 6bfaada commit eabc143

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

lib/matplotlib/pyplot.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ def gcf():
555555
else:
556556
return figure()
557557

558+
558559
def fignum_exists(num):
559560
return _pylab_helpers.Gcf.has_fignum(num) or num in get_figlabels()
560561

@@ -1138,20 +1139,20 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
11381139
sharey = "none"
11391140
share_values = ["all", "row", "col", "none"]
11401141
if sharex not in share_values:
1141-
# This check was added because it is very easy to type subplots(1, 2, 1)
1142-
# when subplot(1, 2, 1) was intended. In most cases, no error will
1143-
# ever occur, but mysterious behavior will result because what was
1144-
# intended to be the subplot index is instead treated as a bool for
1145-
# sharex.
1142+
# This check was added because it is very easy to type
1143+
# `subplots(1, 2, 1)` when `subplot(1, 2, 1)` was intended.
1144+
# In most cases, no error will ever occur, but mysterious behavior will
1145+
# result because what was intended to be the subplot index is instead
1146+
# treated as a bool for sharex.
11461147
if isinstance(sharex, int):
11471148
warnings.warn("sharex argument to subplots() was an integer."
11481149
" Did you intend to use subplot() (without 's')?")
11491150

1150-
raise ValueError("sharex [%s] must be one of %s" % \
1151-
(sharex, share_values))
1151+
raise ValueError("sharex [%s] must be one of %s" %
1152+
(sharex, share_values))
11521153
if sharey not in share_values:
1153-
raise ValueError("sharey [%s] must be one of %s" % \
1154-
(sharey, share_values))
1154+
raise ValueError("sharey [%s] must be one of %s" %
1155+
(sharey, share_values))
11551156
if subplot_kw is None:
11561157
subplot_kw = {}
11571158
if gridspec_kw is None:
@@ -1167,10 +1168,6 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
11671168

11681169
# Create first subplot separately, so we can share it if requested
11691170
ax0 = fig.add_subplot(gs[0, 0], **subplot_kw)
1170-
#if sharex:
1171-
# subplot_kw['sharex'] = ax0
1172-
#if sharey:
1173-
# subplot_kw['sharey'] = ax0
11741171
axarr[0] = ax0
11751172

11761173
r, c = np.mgrid[:nrows, :ncols]
@@ -1203,15 +1200,13 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
12031200

12041201
# turn off redundant tick labeling
12051202
if sharex in ["col", "all"] and nrows > 1:
1206-
#if sharex and nrows>1:
12071203
# turn off all but the bottom row
12081204
for ax in axarr[:-1, :].flat:
12091205
for label in ax.get_xticklabels():
12101206
label.set_visible(False)
12111207
ax.xaxis.offsetText.set_visible(False)
12121208

12131209
if sharey in ["row", "all"] and ncols > 1:
1214-
#if sharey and ncols>1:
12151210
# turn off all but the first column
12161211
for ax in axarr[:, 1:].flat:
12171212
for label in ax.get_yticklabels():
@@ -1222,8 +1217,8 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
12221217
# Reshape the array to have the final desired dimension (nrow,ncol),
12231218
# though discarding unneeded dimensions that equal 1. If we only have
12241219
# one subplot, just return it instead of a 1-element array.
1225-
if nplots==1:
1226-
ret = fig, axarr[0,0]
1220+
if nplots == 1:
1221+
ret = fig, axarr[0, 0]
12271222
else:
12281223
ret = fig, axarr.squeeze()
12291224
else:
@@ -1257,10 +1252,12 @@ def subplot2grid(shape, loc, rowspan=1, colspan=1, **kwargs):
12571252
bbox = a.bbox
12581253
byebye = []
12591254
for other in fig.axes:
1260-
if other==a: continue
1255+
if other == a:
1256+
continue
12611257
if bbox.fully_overlaps(other.bbox):
12621258
byebye.append(other)
1263-
for ax in byebye: delaxes(ax)
1259+
for ax in byebye:
1260+
delaxes(ax)
12641261

12651262
return a
12661263

0 commit comments

Comments
 (0)