| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -276,21 +276,12 @@ def subplots(self, *, sharex=False, sharey=False, squeeze=True, | |||
| 276 | 276 | raise ValueError("GridSpec.subplots() only works for GridSpecs " | |
| 277 | 277 | "created with a parent figure") | |
| 278 | 278 | ||
| 279 | - if isinstance(sharex, bool): | ||
| 279 | + if not isinstance(sharex, str): | ||
| 280 | 280 | sharex = "all" if sharex else "none" | |
| 281 | - if isinstance(sharey, bool): | ||
| 281 | + if not isinstance(sharey, str): | ||
| 282 | 282 | sharey = "all" if sharey else "none" | |
| 283 | - # This check was added because it is very easy to type | ||
| 284 | - # `subplots(1, 2, 1)` when `subplot(1, 2, 1)` was intended. | ||
| 285 | - # In most cases, no error will ever occur, but mysterious behavior | ||
| 286 | - # will result because what was intended to be the subplot index is | ||
| 287 | - # instead treated as a bool for sharex. This check should go away | ||
| 288 | - # once sharex becomes kwonly. | ||
| 289 | - if isinstance(sharex, Integral): | ||
| 290 | - _api.warn_external( | ||
| 291 | - "sharex argument to subplots() was an integer. Did you " | ||
| 292 | - "intend to use subplot() (without 's')?") | ||
| 293 | - _api.check_in_list(["all", "row", "col", "none"], | ||
| 283 | + | ||
| 284 | + _api.check_in_list(["all", "row", "col", "none", False, True], | ||
| 294 | 285 | sharex=sharex, sharey=sharey) | |
| 295 | 286 | if subplot_kw is None: | |
| 296 | 287 | subplot_kw = {} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,7 +84,7 @@ def test_shared(): | |||
| 84 | 84 | plt.close(f) | |
| 85 | 85 | ||
| 86 | 86 | # test all option combinations | |
| 87 | - ops = [False, True, 'all', 'none', 'row', 'col'] | ||
| 87 | + ops = [False, True, 'all', 'none', 'row', 'col', 0, 1] | ||
| 88 | 88 | for xo in ops: | |
| 89 | 89 | for yo in ops: | |
| 90 | 90 | f, ((a1, a2), (a3, a4)) = plt.subplots(2, 2, sharex=xo, sharey=yo) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments