|
6 | 6 | import itertools |
7 | 7 | import re |
8 | 8 | from collections.abc import MutableSequence |
| 9 | +from functools import wraps |
9 | 10 | from numbers import Integral |
| 11 | +from typing import List, Optional, Tuple, Union |
10 | 12 |
|
11 | 13 | import matplotlib.axes as maxes |
12 | 14 | import matplotlib.gridspec as mgridspec |
13 | 15 | import matplotlib.transforms as mtransforms |
14 | 16 | import numpy as np |
15 | | -from typing import List, Optional, Union, Tuple |
16 | | -from functools import wraps |
17 | 17 |
|
18 | 18 | from . import axes as paxes |
19 | 19 | from .config import rc |
20 | | -from .internals import ic # noqa: F401 |
21 | | -from .internals import _not_none, docstring, warnings |
| 20 | +from .internals import ( |
| 21 | + _not_none, |
| 22 | + docstring, |
| 23 | + ic, # noqa: F401 |
| 24 | + warnings, |
| 25 | +) |
22 | 26 | from .utils import _fontsize_to_pt, units |
23 | | -from .internals import warnings |
24 | 27 |
|
25 | 28 | __all__ = ["GridSpec", "SubplotGrid"] |
26 | 29 |
|
@@ -1650,7 +1653,10 @@ def __getitem__(self, key): |
1650 | 1653 | ) |
1651 | 1654 | new_key.append(encoded_keyi) |
1652 | 1655 | xs, ys = new_key |
1653 | | - objs = grid[xs, ys] |
| 1656 | + if np.iterable(xs) and np.iterable(ys): |
| 1657 | + objs = grid[np.ix_(xs, ys)] |
| 1658 | + else: |
| 1659 | + objs = grid[xs, ys] |
1654 | 1660 | if hasattr(objs, "flat"): |
1655 | 1661 | objs = [obj for obj in objs.flat if obj is not None] |
1656 | 1662 | elif not isinstance(objs, list): |
|
0 commit comments