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

Function plot_graph

examples/gromov/plot_gromov_wasserstein_dictionary_learning.py:93–108  ·  view source on GitHub ↗
(x, C, binary=True, color="C0", s=None)

Source from the content-addressed store, hash-verified

91
92
93def plot_graph(x, C, binary=True, color="C0", s=None):
94 for j in range(C.shape[0]):
95 for i in range(j):
96 if binary:
97 if C[i, j] > 0:
98 pl.plot(
99 [x[i, 0], x[j, 0]], [x[i, 1], x[j, 1]], alpha=0.2, color="k"
100 )
101 else: # connection intensity proportional to C[i,j]
102 pl.plot(
103 [x[i, 0], x[j, 0]], [x[i, 1], x[j, 1]], alpha=C[i, j], color="k"
104 )
105
106 pl.scatter(
107 x[:, 0], x[:, 1], c=color, s=s, zorder=10, edgecolors="k", cmap="tab10", vmax=9
108 )
109
110
111pl.figure(1, (12, 8))

Calls

no outgoing calls

Tested by

no test coverage detected