8000 Merge pull request #10119 from anntzer/gridspec-cleanup · matplotlib/matplotlib@8249f8a · GitHub
[go: up one dir, main page]

Skip to content

Commit 8249f8a

Browse files
authored
Merge pull request #10119 from anntzer/gridspec-cleanup
Simplify gridspec.py.
2 parents e3690cb + 03923d7 commit 8249f8a

File tree

4 files changed

+79
-157
lines changed

4 files changed

+79
-157
lines changed

lib/matplotlib/colorbar.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,48 +1217,38 @@ def make_axes_gridspec(parent, **kw):
12171217
shrink = kw.pop('shrink', 1.0)
12181218
aspect = kw.pop('aspect', 20)
12191219

1220-
x1 = 1.0 - fraction
1220+
x1 = 1 - fraction
12211221

12221222
# for shrinking
1223-
pad_s = (1. - shrink) * 0.5
1223+
pad_s = (1 - shrink) * 0.5
12241224
wh_ratios = [pad_s, shrink, pad_s]
12251225

12261226
gs_from_subplotspec = gridspec.GridSpecFromSubplotSpec
12271227
if orientation == 'vertical':
12281228
pad = kw.pop('pad', 0.05)
12291229
wh_space = 2 * pad / (1 - pad)
1230-
12311230
gs = gs_from_subplotspec(1, 2,
12321231
subplot_spec=parent.get_subplotspec(),
12331232
wspace=wh_space,
1234-
width_ratios=[x1 - pad, fraction]
1235-
)
1236-
1233+
width_ratios=[x1 - pad, fraction])
12371234
gs2 = gs_from_subplotspec(3, 1,
12381235
subplot_spec=gs[1],
12391236
hspace=0.,
1240-
height_ratios=wh_ratios,
1241-
)
1242-
1237+
height_ratios=wh_ratios)
12431238
anchor = (0.0, 0.5)
12441239
panchor = (1.0, 0.5)
12451240
else:
12461241
pad = kw.pop('pad', 0.15)
12471242
wh_space = 2 * pad / (1 - pad)
1248-
12491243
gs = gs_from_subplotspec(2, 1,
12501244
subplot_spec=parent.get_subplotspec(),
12511245
hspace=wh_space,
1252-
height_ratios=[x1 - pad, fraction]
1253-
)
1254-
1246+
height_ratios=[x1 - pad, fraction])
12551247
gs2 = gs_from_subplotspec(1, 3,
12561248
subplot_spec=gs[1],
12571249
wspace=0.,
1258-
width_ratios=wh_ratios,
1259-
)
1260-
1261-
aspect = 1.0 / aspect
1250+
width_ratios=wh_ratios)
1251+
aspect = 1 / aspect
12621252
anchor = (0.5, 1.0)
12631253
panchor = (0.5, 0.0)
12641254

0 commit comments

Comments
 (0)
0