Skip to content

Commit 7e06f3c

Browse files
authored
Merge pull request #232 from lucasimi/fix-edge-colors
Fix edge colors
2 parents 75b3f83 + bf11883 commit 7e06f3c

File tree

5 files changed

+541
-519
lines changed

5 files changed

+541
-519
lines changed

docs/source/notebooks/circles.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,8 @@
9696
fig = plot.plot_plotly(
9797
colors=labels,
9898
cmap=["jet", "viridis", "cividis"],
99-
node_size=[0.0, 0.5, 1.0, 1.5, 2.0],
99+
node_size=[0.25 * x for x in range(9)],
100100
agg=np.nanmean,
101-
width=600,
102-
height=600,
103101
)
104102

105103
fig.show(config={"scrollZoom": True}, renderer="notebook_connected")
@@ -119,10 +117,8 @@
119117
fig = plot.plot_plotly(
120118
colors=labels,
121119
cmap=["jet", "viridis", "cividis"],
122-
node_size=[0.0, 0.5, 1.0, 1.5, 2.0],
120+
node_size=[0.25 * x for x in range(9)],
123121
agg=np.nanstd,
124-
width=600,
125-
height=600,
126122
)
127123

128124
fig.show(config={"scrollZoom": True}, renderer="notebook_connected")

docs/source/notebooks/digits.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,8 @@ def mode(arr):
103103
colors=labels,
104104
cmap=["jet", "viridis", "cividis"],
105105
agg=mode,
106-
node_size=[0.0, 0.5, 1.0, 1.5, 2.0],
106+
node_size=[0.25 * x for x in range(9)],
107107
title="mode of digits",
108-
width=600,
109-
height=600,
110108
)
111109

112110
fig.show(config={"scrollZoom": True}, renderer="notebook_connected")
@@ -134,10 +132,8 @@ def entropy(arr):
134132
colors=labels,
135133
cmap=["jet", "viridis", "cividis"],
136134
agg=entropy,
137-
node_size=[0.0, 0.5, 1.0, 1.5, 2.0],
135+
node_size=[0.25 * x for x in range(9)],
138136
title="entropy of digits",
139-
width=600,
140-
height=600,
141137
)
142138

143139
fig.show(config={"scrollZoom": True}, renderer="notebook_connected")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "tda-mapper"
7-
version = "0.11.1"
7+
version = "0.11.2"
88
description = "A simple and efficient Python implementation of Mapper algorithm for Topological Data Analysis"
99
readme = "README.md"
1010
authors = [{ name = "Luca Simi", email = "[email protected]" }]

src/tdamapper/plot.py

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ def plot_matplotlib(
103103
node_size=1,
104104
agg=np.nanmean,
105105
title=None,
106+
cmap="jet",
106107
width=512,
107108
height=512,
108-
cmap="jet",
109109
):
110110
"""
111111
Draw a static plot using Matplotlib.
@@ -123,15 +123,15 @@ def plot_matplotlib(
123123
:type agg: Callable, optional
124124
:param title: The title to be displayed alongside the figure.
125125
:type title: str, optional
126+
:param cmap: The name of a colormap used to map `colors` data values,
127+
aggregated by `agg`, to actual RGBA colors. Defaults to 'jet'.
128+
:type cmap: str, optional
126129
:param width: The desired width of the figure in pixels. Defaults to
127130
512.
128131
:type width: int, optional
129132
:param height: The desired height of the figure in pixels. Defaults to
130133
512
131134
:type height: int, optional
132-
:param cmap: The name of a colormap used to map `colors` data values,
133-
aggregated by `agg`, to actual RGBA colors. Defaults to 'jet'.
134-
:type cmap: str, optional
135135
136136
:return: A static matplotlib figure that can be displayed on screen
137137
and notebooks.
@@ -145,9 +145,9 @@ def plot_matplotlib(
145145
node_size=node_size,
146146
agg=agg,
147147
title=title,
148+
cmap=cmap,
148149
width=width,
149150
height=height,
150-
cmap=cmap,
151151
)
152152

153153
def plot_plotly(
@@ -156,9 +156,9 @@ def plot_plotly(
156156
node_size=1,
157157
agg=np.nanmean,
158158
title=None,
159-
width=512,
160-
height=512,
161159
cmap="jet",
160+
width=None,
161+
height=None,
162162
):
163163
"""
164164
Draw an interactive plot using Plotly.
@@ -180,15 +180,13 @@ def plot_plotly(
180180
and title is a list of string, each item will be used as title for
181181
its corresponding colormap.
182182
:type title: str, list[str], optional
183-
:param width: The desired width of the figure in pixels. Defaults to
184-
512.
185-
:type width: int, optional
186-
:param height: The desired height of the figure in pixels. Defaults to
187-
512.
188-
:type height: int, optional
189183
:param cmap: The name of a colormap used to map `colors` data values,
190184
aggregated by `agg`, to actual RGBA colors. Defaults to 'jet'.
191185
:type cmap: str, optional
186+
:param width: The desired width of the figure in pixels.
187+
:type width: int, optional
188+
:param height: The desired height of the figure in pixels.
189+
:type height: int, optional
192190
193191
:return: An interactive Plotly figure that can be displayed on screen
194192
and notebooks. For 3D embeddings, the figure requires a WebGL
@@ -201,9 +199,9 @@ def plot_plotly(
201199
node_size=node_size,
202200
agg=agg,
203201
title=title,
202+
cmap=cmap,
204203
width=width,
205204
height=height,
206-
cmap=cmap,
207205
)
208206

209207
def plot_plotly_update(
@@ -213,9 +211,9 @@ def plot_plotly_update(
213211
node_size=None,
214212
agg=None,
215213
title=None,
214+
cmap=None,
216215
width=None,
217216
height=None,
218-
cmap=None,
219217
):
220218
"""
221219
Draw an interactive plot using Plotly on a previously rendered figure.
@@ -240,15 +238,15 @@ def plot_plotly_update(
240238
:param title: The title to be displayed alongside the figure. Defaults
241239
to None.
242240
:type title: str, optional
241+
:param cmap: The name of a colormap used to map `colors` data values,
242+
aggregated by `agg`, to actual RGBA colors. Defaults to None.
243+
:type cmap: str, optional
243244
:param width: The desired width of the figure in pixels. Defaults to
244245
None.
245246
:type width: int, optional
246247
:param height: The desired height of the figure in pixels. Defaults to
247248
None.
248249
:type height: int, optional
249-
:param cmap: The name of a colormap used to map `colors` data values,
250-
aggregated by `agg`, to actual RGBA colors. Defaults to None.
251-
:type cmap: str, optional
252250
253251
:return: An interactive Plotly figure that can be displayed on screen
254252
and notebooks. For 3D embeddings, the figure requires a WebGL
@@ -262,9 +260,9 @@ def plot_plotly_update(
262260
node_size=node_size,
263261
agg=agg,
264262
title=title,
263+
cmap=cmap,
265264
width=width,
266265
height=height,
267-
cmap=cmap,
268266
)
269267

270268
def plot_pyvis(
@@ -274,9 +272,9 @@ def plot_pyvis(
274272
node_size=1,
275273
agg=np.nanmean,
276274
title=None,
275+
cmap="jet",
277276
width=512,
278277
height=512,
279-
cmap="jet",
280278
):
281279
"""
282280
Draw an interactive HTML plot using PyVis.
@@ -298,15 +296,15 @@ def plot_pyvis(
298296
:param title: The title to be displayed alongside the figure. Defaults
299297
to None.
300298
:type title: str, optional
299+
:param cmap: The name of a colormap used to map `colors` data values,
300+
aggregated by `agg`, to actual RGBA colors. Defaults to 'jet'.
301+
:type cmap: str, optional
301302
:param width: The desired width of the figure in pixels. Defaults to
302303
512.
303304
:type width: int, optional
304305
:param height: The desired height of the figure in pixels. Defaults to
305306
512.
306307
:type height: int, optional
307-
:param cmap: The name of a colormap used to map `colors` data values,
308-
aggregated by `agg`, to actual RGBA colors. Defaults to 'jet'.
309-
:type cmap: str, optional
310308
"""
311309
return plot_pyvis(
312310
self,
@@ -315,9 +313,9 @@ def plot_pyvis(
315313
node_size=node_size,
316314
agg=agg,
317315
title=title,
316+
cmap=cmap,
318317
width=width,
319318
height=height,
320-
cmap=cmap,
321319
)
322320

323321

0 commit comments

Comments
 (0)