MCPcopy Create free account
hub / github.com/PythonOT/POT / plot1D_mat

Function plot1D_mat

ot/plot.py:20–163  ·  view source on GitHub ↗

r"""Plot matrix :math:`\mathbf{M}` with the source and target 1D distributions. Creates a subplot with the source distribution :math:`\mathbf{a}` and target distribution :math:`\mathbf{b}`. In 'yx' mode (default), the source is on the left and the target on the top, and in 'xy' mode

(
    a,
    b,
    M,
    title="",
    plot_style="yx",
    a_label="",
    b_label="",
    color_source="b",
    color_target="r",
    coupling_cmap="gray_r",
)

Source from the content-addressed store, hash-verified

18
19
20def plot1D_mat(
21 a,
22 b,
23 M,
24 title="",
25 plot_style="yx",
26 a_label="",
27 b_label="",
28 color_source="b",
29 color_target="r",
30 coupling_cmap="gray_r",
31):
32 r"""Plot matrix :math:`\mathbf{M}` with the source and target 1D distributions.
33
34 Creates a subplot with the source distribution :math:`\mathbf{a}` and target
35 distribution :math:`\mathbf{b}`.
36 In 'yx' mode (default), the source is on the left and
37 the target on the top, and in 'xy' mode, source on the bottom (upside
38 down) and the target on the left.
39 The matrix :math:`\mathbf{M}` is shown in between.
40
41 Parameters
42 ----------
43 a : ndarray, shape (na,)
44 Source distribution
45 b : ndarray, shape (nb,)
46 Target distribution
47 M : ndarray, shape (na, nb)
48 Matrix to plot
49 title : str, optional
50 Title of the plot
51 plot_style : str, optional
52 Style of the plot, 'yx' or 'xy'. 'yx' places the source on the left and
53 the target on the top, 'xy' places the source on the bottom (upside
54 down) and the target on the left.
55 a_label : str, optional
56 Label for source distribution
57 b_label : str, optional
58 Label for target distribution
59 color_source : str, optional
60 Color of the source distribution
61 color_target : str, optional
62 Color of the target distribution
63 coupling_cmap : str, optional
64 Colormap for the coupling matrix
65
66 Returns
67 -------
68 ax1 : source plot ax
69 ax2 : target plot ax
70 ax3 : coupling plot ax
71
72 See Also
73 --------
74 :func:`rescale_for_imshow_plot`
75 """
76 assert plot_style in ["yx", "xy"], "plot_style should be 'yx' or 'xy'"
77 na, nb = M.shape

Callers 1

plot_GMMOT_plan.pyFile · 0.90

Calls 3

_set_ticks_and_spinesFunction · 0.85
arangeMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected