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

Function test_secondary_minorloc

lib/matplotlib/tests/test_axes.py:8595–8616  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8593
8594
8595def test_secondary_minorloc():
8596 fig, ax = plt.subplots(figsize=(10, 5))
8597 ax.plot(np.arange(2, 11), np.arange(2, 11))
8598
8599 def invert(x):
8600 with np.errstate(divide='ignore'):
8601 return 1 / x
8602
8603 secax = ax.secondary_xaxis('top', functions=(invert, invert))
8604 assert isinstance(secax._axis.get_minor_locator(),
8605 mticker.NullLocator)
8606 secax.minorticks_on()
8607 assert isinstance(secax._axis.get_minor_locator(),
8608 mticker.AutoMinorLocator)
8609 ax.set_xscale('log')
8610 plt.draw()
8611 assert isinstance(secax._axis.get_minor_locator(),
8612 mticker.LogLocator)
8613 ax.set_xscale('linear')
8614 plt.draw()
8615 assert isinstance(secax._axis.get_minor_locator(),
8616 mticker.NullLocator)
8617
8618
8619def test_secondary_formatter():

Callers

nothing calls this directly

Calls 7

secondary_xaxisMethod · 0.80
get_minor_locatorMethod · 0.80
set_xscaleMethod · 0.80
subplotsMethod · 0.45
plotMethod · 0.45
minorticks_onMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…