| 68 | |
| 69 | @pytest.mark.skipif(nogo, reason="Matplotlib not installed") |
| 70 | def test_plot2D_samples_mat(): |
| 71 | import ot |
| 72 | import ot.plot |
| 73 | |
| 74 | n_bins = 50 # nb samples |
| 75 | |
| 76 | mu_s = np.array([0, 0]) |
| 77 | cov_s = np.array([[1, 0], [0, 1]]) |
| 78 | |
| 79 | mu_t = np.array([4, 4]) |
| 80 | cov_t = np.array([[1, -0.8], [-0.8, 1]]) |
| 81 | |
| 82 | rng = np.random.RandomState(42) |
| 83 | xs = ot.datasets.make_2D_samples_gauss(n_bins, mu_s, cov_s, random_state=rng) |
| 84 | xt = ot.datasets.make_2D_samples_gauss(n_bins, mu_t, cov_t, random_state=rng) |
| 85 | |
| 86 | G = 1.0 * (rng.rand(n_bins, n_bins) < 0.01) |
| 87 | |
| 88 | ot.plot.plot2D_samples_mat(xs, xt, G, thr=1e-5) |
| 89 | ot.plot.plot2D_samples_mat(xs, xt, G, thr=1e-5, alpha=0.5) |