|
3 | 3 | import networkx as nx |
4 | 4 | import numpy as np |
5 | 5 |
|
6 | | -from tdamapper.clustering import TrivialClustering |
7 | | -from tdamapper.core import MapperAlgorithm |
| 6 | +from tdamapper.core import TrivialClustering |
8 | 7 | from tdamapper.cover import BallCover |
9 | | -from tdamapper.plot import MapperLayoutInteractive, MapperLayoutStatic, MapperPlot |
| 8 | +from tdamapper.learn import MapperAlgorithm |
| 9 | +from tdamapper.plot import MapperPlot |
10 | 10 |
|
11 | 11 |
|
12 | 12 | class TestMapperPlot(unittest.TestCase): |
@@ -72,46 +72,48 @@ def test_two_connected_clusters_deprecated(self): |
72 | 72 | np.array([0.0, 0.0]), |
73 | 73 | np.array([1.0, 1.0]), |
74 | 74 | ] |
75 | | - mp = MapperAlgorithm( |
| 75 | + mapper_algo = MapperAlgorithm( |
76 | 76 | cover=BallCover(1.1, metric="euclidean"), clustering=TrivialClustering() |
77 | 77 | ) |
78 | | - g = mp.fit_transform(data, data) |
79 | | - mp_plot1 = MapperLayoutInteractive( |
| 78 | + g = mapper_algo.fit_transform(data, data) |
| 79 | + mapper_plot_1 = MapperPlot( |
80 | 80 | g, |
81 | 81 | dim=2, |
82 | | - colors=data, |
83 | 82 | seed=123, |
84 | 83 | iterations=10, |
| 84 | + ) |
| 85 | + mapper_plot_1.plot_plotly( |
| 86 | + colors=data, |
85 | 87 | agg=np.nanmax, |
86 | 88 | width=200, |
87 | 89 | height=200, |
88 | 90 | title="example", |
89 | 91 | cmap="jet", |
90 | 92 | ) |
91 | | - mp_plot1.plot() |
92 | | - mp_plot2 = MapperLayoutInteractive( |
| 93 | + mapper_plot_2 = MapperPlot( |
93 | 94 | g, |
94 | 95 | dim=3, |
95 | | - colors=data, |
96 | 96 | seed=123, |
97 | 97 | iterations=10, |
| 98 | + ) |
| 99 | + fig = mapper_plot_2.plot_plotly( |
| 100 | + colors=data, |
98 | 101 | agg=np.nanmax, |
99 | 102 | width=200, |
100 | 103 | height=200, |
101 | 104 | title="example", |
102 | 105 | cmap="jet", |
103 | 106 | ) |
104 | | - mp_plot2.plot() |
105 | | - mp_plot2.update( |
| 107 | + mapper_plot_2.plot_plotly_update( |
| 108 | + fig, |
106 | 109 | colors=data, |
107 | | - seed=124, |
108 | | - iterations=15, |
109 | 110 | agg=np.nanmin, |
110 | 111 | width=300, |
111 | 112 | height=300, |
112 | 113 | title="example-updated", |
113 | 114 | cmap="viridis", |
114 | 115 | ) |
115 | | - mp_plot2.plot() |
116 | | - mp_plot3 = MapperLayoutStatic(g, colors=data, dim=2) |
117 | | - mp_plot3.plot() |
| 116 | + mapper_plot_3 = MapperPlot(g, dim=2) |
| 117 | + mapper_plot_3.plot_matplotlib( |
| 118 | + colors=data, |
| 119 | + ) |
0 commit comments