def test_general_plot2d(): """ Test general plot2d -- whether 2d-Hist can be plotted properly. """ h = Hist( axis.Regular(50, -5, 5, name="A", label="a [units]", underflow=False, overflow=False), axis.Regular(50, -4, 4, name="B", label="b [units]", underflow=False, overflow=False), ).fill(np.random.normal(size=10), np.random.normal(size=10)) assert h.plot2d(cmap="cividis") # dimension error h = Hist( axis.Regular(50, -5, 5, name="A", label="a [units]", underflow=False, overflow=False), axis.Regular(50, -4, 4, name="B", label="b [units]", underflow=False, overflow=False), ).fill(np.random.normal(size=10), np.random.normal(size=10)) with pytest.raises(Exception): h.project("A").plot2d() # wrong kwargs names with pytest.raises(Exception): h.plot2d(abc="red") # wrong kwargs type with pytest.raises(Exception): h.plot2d(cmap=0.1) plt.close("all")