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

Function test_bar_leading_nan

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

Source from the content-addressed store, hash-verified

9726
9727
9728def test_bar_leading_nan():
9729
9730 barx = np.arange(3, dtype=float)
9731 barheights = np.array([0.5, 1.5, 2.0])
9732 barstarts = np.array([0.77]*3)
9733
9734 barx[0] = np.nan
9735
9736 fig, ax = plt.subplots()
9737
9738 bars = ax.bar(barx, barheights, bottom=barstarts)
9739
9740 hbars = ax.barh(barx, barheights, left=barstarts)
9741
9742 for bar_set in (bars, hbars):
9743 # the first bar should have a nan in the location
9744 nanful, *rest = bar_set
9745 assert (~np.isfinite(nanful.xy)).any()
9746 assert np.isfinite(nanful.get_width())
9747 for b in rest:
9748 assert np.isfinite(b.xy).all()
9749 assert np.isfinite(b.get_width())
9750
9751
9752@check_figures_equal()

Callers

nothing calls this directly

Calls 4

barhMethod · 0.80
subplotsMethod · 0.45
barMethod · 0.45
get_widthMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…