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

Function test_axes_removal

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

Source from the content-addressed store, hash-verified

855
856
857def test_axes_removal():
858 # Check that units can set the formatter after an Axes removal
859 fig, axs = plt.subplots(1, 2, sharex=True)
860 axs[1].remove()
861 axs[0].plot([datetime(2000, 1, 1), datetime(2000, 2, 1)], [0, 1])
862 assert isinstance(axs[0].xaxis.get_major_formatter(),
863 mdates.AutoDateFormatter)
864
865 # Check that manually setting the formatter, then removing Axes keeps
866 # the set formatter.
867 fig, axs = plt.subplots(1, 2, sharex=True)
868 axs[1].xaxis.set_major_formatter(ScalarFormatter())
869 axs[1].remove()
870 axs[0].plot([datetime(2000, 1, 1), datetime(2000, 2, 1)], [0, 1])
871 assert isinstance(axs[0].xaxis.get_major_formatter(),
872 ScalarFormatter)
873
874
875def test_removed_axis():

Callers

nothing calls this directly

Calls 6

ScalarFormatterClass · 0.90
get_major_formatterMethod · 0.80
subplotsMethod · 0.45
removeMethod · 0.45
plotMethod · 0.45
set_major_formatterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…