()
| 236 | |
| 237 | |
| 238 | def test_gca(): |
| 239 | fig = plt.figure() |
| 240 | |
| 241 | # test that gca() picks up Axes created via add_axes() |
| 242 | ax0 = fig.add_axes((0, 0, 1, 1)) |
| 243 | assert fig.gca() is ax0 |
| 244 | |
| 245 | # test that gca() picks up Axes created via add_subplot() |
| 246 | ax1 = fig.add_subplot(111) |
| 247 | assert fig.gca() is ax1 |
| 248 | |
| 249 | # add_axes on an existing Axes should not change stored order, but will |
| 250 | # make it current. |
| 251 | fig.add_axes(ax0) |
| 252 | assert fig.axes == [ax0, ax1] |
| 253 | assert fig.gca() is ax0 |
| 254 | |
| 255 | # sca() should not change stored order of Axes, which is order added. |
| 256 | fig.sca(ax0) |
| 257 | assert fig.axes == [ax0, ax1] |
| 258 | |
| 259 | # add_subplot on an existing Axes should not change stored order, but will |
| 260 | # make it current. |
| 261 | fig.add_subplot(ax1) |
| 262 | assert fig.axes == [ax0, ax1] |
| 263 | assert fig.gca() is ax1 |
| 264 | |
| 265 | |
| 266 | def test_add_subplot_subclass(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…