Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions docs/source/notebooks/circles.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,8 @@
fig = plot.plot_plotly(
colors=labels,
cmap=["jet", "viridis", "cividis"],
node_size=[0.0, 0.5, 1.0, 1.5, 2.0],
node_size=[0.25 * x for x in range(9)],
agg=np.nanmean,
width=600,
height=600,
)

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

fig.show(config={"scrollZoom": True}, renderer="notebook_connected")
Expand Down
8 changes: 2 additions & 6 deletions docs/source/notebooks/digits.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ def mode(arr):
colors=labels,
cmap=["jet", "viridis", "cividis"],
agg=mode,
node_size=[0.0, 0.5, 1.0, 1.5, 2.0],
node_size=[0.25 * x for x in range(9)],
title="mode of digits",
width=600,
height=600,
)

fig.show(config={"scrollZoom": True}, renderer="notebook_connected")
Expand Down Expand Up @@ -134,10 +132,8 @@ def entropy(arr):
colors=labels,
cmap=["jet", "viridis", "cividis"],
agg=entropy,
node_size=[0.0, 0.5, 1.0, 1.5, 2.0],
node_size=[0.25 * x for x in range(9)],
title="entropy of digits",
width=600,
height=600,
)

fig.show(config={"scrollZoom": True}, renderer="notebook_connected")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "tda-mapper"
version = "0.11.1"
version = "0.11.2"
description = "A simple and efficient Python implementation of Mapper algorithm for Topological Data Analysis"
readme = "README.md"
authors = [{ name = "Luca Simi", email = "lucasimi90@gmail.com" }]
Expand Down
46 changes: 22 additions & 24 deletions src/tdamapper/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ def plot_matplotlib(
node_size=1,
agg=np.nanmean,
title=None,
cmap="jet",
width=512,
height=512,
cmap="jet",
):
"""
Draw a static plot using Matplotlib.
Expand All @@ -123,15 +123,15 @@ def plot_matplotlib(
:type agg: Callable, optional
:param title: The title to be displayed alongside the figure.
:type title: str, optional
:param cmap: The name of a colormap used to map `colors` data values,
aggregated by `agg`, to actual RGBA colors. Defaults to 'jet'.
:type cmap: str, optional
:param width: The desired width of the figure in pixels. Defaults to
512.
:type width: int, optional
:param height: The desired height of the figure in pixels. Defaults to
512
:type height: int, optional
:param cmap: The name of a colormap used to map `colors` data values,
aggregated by `agg`, to actual RGBA colors. Defaults to 'jet'.
:type cmap: str, optional

:return: A static matplotlib figure that can be displayed on screen
and notebooks.
Expand All @@ -145,9 +145,9 @@ def plot_matplotlib(
node_size=node_size,
agg=agg,
title=title,
cmap=cmap,
width=width,
height=height,
cmap=cmap,
)

def plot_plotly(
Expand All @@ -156,9 +156,9 @@ def plot_plotly(
node_size=1,
agg=np.nanmean,
title=None,
width=512,
height=512,
cmap="jet",
width=None,
height=None,
):
"""
Draw an interactive plot using Plotly.
Expand All @@ -180,15 +180,13 @@ def plot_plotly(
and title is a list of string, each item will be used as title for
its corresponding colormap.
:type title: str, list[str], optional
:param width: The desired width of the figure in pixels. Defaults to
512.
:type width: int, optional
:param height: The desired height of the figure in pixels. Defaults to
512.
:type height: int, optional
:param cmap: The name of a colormap used to map `colors` data values,
aggregated by `agg`, to actual RGBA colors. Defaults to 'jet'.
:type cmap: str, optional
:param width: The desired width of the figure in pixels.
:type width: int, optional
:param height: The desired height of the figure in pixels.
:type height: int, optional

:return: An interactive Plotly figure that can be displayed on screen
and notebooks. For 3D embeddings, the figure requires a WebGL
Expand All @@ -201,9 +199,9 @@ def plot_plotly(
node_size=node_size,
agg=agg,
title=title,
cmap=cmap,
width=width,
height=height,
cmap=cmap,
)

def plot_plotly_update(
Expand All @@ -213,9 +211,9 @@ def plot_plotly_update(
node_size=None,
agg=None,
title=None,
cmap=None,
width=None,
height=None,
cmap=None,
):
"""
Draw an interactive plot using Plotly on a previously rendered figure.
Expand All @@ -240,15 +238,15 @@ def plot_plotly_update(
:param title: The title to be displayed alongside the figure. Defaults
to None.
:type title: str, optional
:param cmap: The name of a colormap used to map `colors` data values,
aggregated by `agg`, to actual RGBA colors. Defaults to None.
:type cmap: str, optional
:param width: The desired width of the figure in pixels. Defaults to
None.
:type width: int, optional
:param height: The desired height of the figure in pixels. Defaults to
None.
:type height: int, optional
:param cmap: The name of a colormap used to map `colors` data values,
aggregated by `agg`, to actual RGBA colors. Defaults to None.
:type cmap: str, optional

:return: An interactive Plotly figure that can be displayed on screen
and notebooks. For 3D embeddings, the figure requires a WebGL
Expand All @@ -262,9 +260,9 @@ def plot_plotly_update(
node_size=node_size,
agg=agg,
title=title,
cmap=cmap,
width=width,
height=height,
cmap=cmap,
)

def plot_pyvis(
Expand All @@ -274,9 +272,9 @@ def plot_pyvis(
node_size=1,
agg=np.nanmean,
title=None,
cmap="jet",
width=512,
height=512,
cmap="jet",
):
"""
Draw an interactive HTML plot using PyVis.
Expand All @@ -298,15 +296,15 @@ def plot_pyvis(
:param title: The title to be displayed alongside the figure. Defaults
to None.
:type title: str, optional
:param cmap: The name of a colormap used to map `colors` data values,
aggregated by `agg`, to actual RGBA colors. Defaults to 'jet'.
:type cmap: str, optional
:param width: The desired width of the figure in pixels. Defaults to
512.
:type width: int, optional
:param height: The desired height of the figure in pixels. Defaults to
512.
:type height: int, optional
:param cmap: The name of a colormap used to map `colors` data values,
aggregated by `agg`, to actual RGBA colors. Defaults to 'jet'.
:type cmap: str, optional
"""
return plot_pyvis(
self,
Expand All @@ -315,9 +313,9 @@ def plot_pyvis(
node_size=node_size,
agg=agg,
title=title,
cmap=cmap,
width=width,
height=height,
cmap=cmap,
)


Expand Down
Loading