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

Function test_colorbar_ticks

lib/matplotlib/tests/test_colorbar.py:371–382  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

369
370
371def test_colorbar_ticks():
372 # test fix for #5673
373 fig, ax = plt.subplots()
374 x = np.arange(-3.0, 4.001)
375 y = np.arange(-4.0, 3.001)
376 X, Y = np.meshgrid(x, y)
377 Z = X * Y
378 clevs = np.array([-12, -5, 0, 5, 12], dtype=float)
379 colors = ['r', 'g', 'b', 'c']
380 cs = ax.contourf(X, Y, Z, clevs, colors=colors, extend='neither')
381 cbar = fig.colorbar(cs, ax=ax, orientation='horizontal', ticks=clevs)
382 assert len(cbar.ax.xaxis.get_ticklocs()) == len(clevs)
383
384
385def test_colorbar_minorticks_on_off():

Callers

nothing calls this directly

Calls 4

get_ticklocsMethod · 0.80
subplotsMethod · 0.45
contourfMethod · 0.45
colorbarMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…