MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_gca

Function test_gca

lib/matplotlib/tests/test_figure.py:238–263  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

236
237
238def 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
266def test_add_subplot_subclass():

Callers

nothing calls this directly

Calls 5

figureMethod · 0.80
add_axesMethod · 0.80
gcaMethod · 0.80
add_subplotMethod · 0.80
scaMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…