@@ -2092,8 +2092,6 @@ def _do_layout(gs, mosaic, unique_ids, nested):
2092
2092
start_col = slc [1 ].start
2093
2093
this_level [(start_row , start_col )] = (label , slc , 'axes' )
2094
2094
2095
-
2096
-
2097
2095
# do the same thing for the nested mosaics (simpler because these
2098
2096
# cannot be spans yet!)
2099
2097
for (j , k ), nested_mosaic in nested .items ():
@@ -2113,7 +2111,6 @@ def _do_layout(gs, mosaic, unique_ids, nested):
2113
2111
raise ValueError (f"There are duplicate keys { label } "
2114
2112
f"in the layout\n { mosaic !r} " )
2115
2113
2116
- # shared_with = {"none": None, "all": "all", "row": "row", "col": "col"}
2117
2114
ax = self .add_subplot (
2118
2115
gs [slc ], ** {
2119
2116
'label' : str (label ),
@@ -2144,14 +2141,12 @@ def _do_layout(gs, mosaic, unique_ids, nested):
2144
2141
raise RuntimeError ("This should never happen" )
2145
2142
return output
2146
2143
2147
-
2148
2144
mosaic = _make_array (mosaic )
2149
2145
rows , cols = mosaic .shape
2150
2146
gs = self .add_gridspec (rows , cols , ** gridspec_kw )
2151
2147
ret = _do_layout (gs , mosaic , * _identify_keys_and_nested (mosaic ))
2152
2148
2153
2149
# Handle axes sharing
2154
-
2155
2150
def _find_row_col_groups (mosaic , unique_labels ):
2156
2151
label_to_span = _parse_mosaic_to_span (mosaic , unique_labels )
2157
2152
@@ -2171,7 +2166,6 @@ def _find_row_col_groups(mosaic, unique_labels):
2171
2166
else :
2172
2167
row_group [(start_row , end_row )].append (label )
2173
2168
2174
-
2175
2169
return row_group , col_group
2176
2170
2177
2171
# Pairs of axes where the first axes is meant to call sharex/sharey on
@@ -2185,16 +2179,31 @@ def check_is_nested():
2185
2179
return True
2186
2180
return False
2187
2181
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
+ }
2189
2188
if sharex in ("row" , "col" ) or sharey in ("row" , "col" ):
2190
2189
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
+ )
2192
2193
else :
2193
2194
row_groups , col_groups = _find_row_col_groups (mosaic , ret .keys ())
2194
2195
2195
2196
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
+ ),
2198
2207
})
2199
2208
2200
2209
if sharex in share_axes_pairs :
0 commit comments