| 19 | |
| 20 | @pytest.mark.skipif(nogo, reason="Matplotlib not installed") |
| 21 | def test_plot1D_mat(): |
| 22 | import ot |
| 23 | import ot.plot |
| 24 | |
| 25 | n_bins = 100 # nb bins |
| 26 | |
| 27 | # bin positions |
| 28 | x = np.arange(n_bins, dtype=np.float64) |
| 29 | |
| 30 | # Gaussian distributions |
| 31 | a = ot.datasets.make_1D_gauss(n_bins, m=20, s=5) # m= mean, s= std |
| 32 | b = ot.datasets.make_1D_gauss(n_bins, m=60, s=10) |
| 33 | |
| 34 | # loss matrix |
| 35 | M = ot.dist(x.reshape((n_bins, 1)), x.reshape((n_bins, 1))) |
| 36 | M /= M.max() |
| 37 | |
| 38 | ot.plot.plot1D_mat(a, b, M) |
| 39 | ot.plot.plot1D_mat(a, b, M, plot_style="xy") |
| 40 | |
| 41 | with pytest.raises(AssertionError): |
| 42 | ot.plot.plot1D_mat(a, b, M, plot_style="NotAValidStyle") |
| 43 | |
| 44 | |
| 45 | @pytest.mark.skipif(nogo, reason="Matplotlib not installed") |