| 9726 | |
| 9727 | |
| 9728 | def 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() |