Skip to content

Commit af4f6ae

Browse files
committed
Fix lint
1 parent 4bf4c69 commit af4f6ae

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

lib/matplotlib/figure.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,8 +2092,6 @@ def _do_layout(gs, mosaic, unique_ids, nested):
20922092
start_col = slc[1].start
20932093
this_level[(start_row, start_col)] = (label, slc, 'axes')
20942094

2095-
2096-
20972095
# do the same thing for the nested mosaics (simpler because these
20982096
# cannot be spans yet!)
20992097
for (j, k), nested_mosaic in nested.items():
@@ -2113,7 +2111,6 @@ def _do_layout(gs, mosaic, unique_ids, nested):
21132111
raise ValueError(f"There are duplicate keys {label} "
21142112
f"in the layout\n{mosaic!r}")
21152113

2116-
# shared_with = {"none": None, "all": "all", "row": "row", "col": "col"}
21172114
ax = self.add_subplot(
21182115
gs[slc], **{
21192116
'label': str(label),
@@ -2144,14 +2141,12 @@ def _do_layout(gs, mosaic, unique_ids, nested):
21442141
raise RuntimeError("This should never happen")
21452142
return output
21462143

2147-
21482144
mosaic = _make_array(mosaic)
21492145
rows, cols = mosaic.shape
21502146
gs = self.add_gridspec(rows, cols, **gridspec_kw)
21512147
ret = _do_layout(gs, mosaic, *_identify_keys_and_nested(mosaic))
21522148

21532149
# Handle axes sharing
2154-
21552150
def _find_row_col_groups(mosaic, unique_labels):
21562151
label_to_span = _parse_mosaic_to_span(mosaic, unique_labels)
21572152

@@ -2171,7 +2166,6 @@ def _find_row_col_groups(mosaic, unique_labels):
21712166
else:
21722167
row_group[(start_row, end_row)].append(label)
21732168

2174-
21752169
return row_group, col_group
21762170

21772171
# Pairs of axes where the first axes is meant to call sharex/sharey on
@@ -2185,16 +2179,31 @@ def check_is_nested():
21852179
return True
21862180
return False
21872181

2188-
share_axes_pairs = {"all": tuple((ax, next(iter(ret.values()))) for ax in ret.values())}
2182+
share_axes_pairs = {
2183+
"all": tuple(
2184+
(ax, next(iter(ret.values())))
2185+
for ax in ret.values()
2186+
)
2187+
}
21892188
if sharex in ("row", "col") or sharey in ("row", "col"):
21902189
if check_is_nested():
2191-
raise ValueError("Cannot share axes by row or column when using nested mosaic")
2190+
raise ValueError(
2191+
"Cannot share axes by row or column when using nested mosaic"
2192+
)
21922193
else:
21932194
row_groups, col_groups = _find_row_col_groups(mosaic, ret.keys())
21942195

21952196
share_axes_pairs.update({
2196-
"row": tuple((ret[label], ret[row_group[0]]) for row_group in row_groups.values() for label in row_group),
2197-
"col": tuple((ret[label], ret[col_group[0]]) for col_group in col_groups.values() for label in col_group),
2197+
"row": tuple(
2198+
(ret[label], ret[row_group[0]])
2199+
for row_group in row_groups.values()
2200+
for label in row_group
2201+
),
2202+
"col": tuple(
2203+
(ret[label], ret[col_group[0]])
2204+
for col_group in col_groups.values()
2205+
for label in col_group
2206+
),
21982207
})
21992208

22002209
if sharex in share_axes_pairs:

0 commit comments

Comments
 (0)