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

Function test_axes_clear_behavior

lib/matplotlib/tests/test_axes.py:9986–10024  ·  view source on GitHub ↗

Test that the given tick params are not reset by ax.clear().

(fig_ref, fig_test, which)

Source from the content-addressed store, hash-verified

9984@check_figures_equal()
9985@pytest.mark.parametrize("which", ("x", "y"))
9986def test_axes_clear_behavior(fig_ref, fig_test, which):
9987 """Test that the given tick params are not reset by ax.clear()."""
9988 ax_test = fig_test.subplots()
9989 ax_ref = fig_ref.subplots()
9990 # the following tick params values are chosen to each create a visual difference
9991 # from their defaults
9992 target = {
9993 "direction": "in",
9994 "length": 10,
9995 "width": 10,
9996 "color": "xkcd:wine red",
9997 "pad": 0,
9998 "labelfontfamily": "serif",
9999 "zorder": 7,
10000 "labelrotation": 45,
10001 "labelcolor": "xkcd:shocking pink",
10002 # this overrides color + labelcolor, skip
10003 # colors: ,
10004 "grid_color": "xkcd:fluorescent green",
10005 "grid_alpha": 0.5,
10006 "grid_linewidth": 3,
10007 "grid_linestyle": ":",
10008 "bottom": False,
10009 "top": True,
10010 "left": False,
10011 "right": True,
10012 "labelbottom": True,
10013 "labeltop": True,
10014 "labelleft": True,
10015 "labelright": True,
10016 }
10017
10018 ax_ref.tick_params(axis=which, **target)
10019
10020 ax_test.tick_params(axis=which, **target)
10021 ax_test.clear()
10022
10023 ax_ref.grid(True)
10024 ax_test.grid(True)
10025
10026
10027@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 4

subplotsMethod · 0.45
tick_paramsMethod · 0.45
clearMethod · 0.45
gridMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…