Skip to content

Commit 48e7940

Browse files
committed
Added colorscales. Added script
1 parent b1e907f commit 48e7940

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ dev = [
5252
"flake8",
5353
"nbformat>=4.2.0",
5454
]
55+
app = [
56+
"pandas<3.0.0",
57+
"scikit-learn<1.6.0",
58+
"nicegui>=2.18.0,<3.0.0",
59+
"umap-learn<0.6.0",
60+
]
61+
62+
[project.scripts]
63+
tda-mapper-app = "tdamapper.app:main"
5564

5665
[project.urls]
5766
Homepage = "https://github.com/lucasimi/tda-mapper-python"

src/tdamapper/app.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,19 @@ def run_mapper(df, labels, **kwargs):
199199
).plot_plotly(
200200
colors=df_colors.to_numpy(),
201201
title=df_colors.columns.to_list(),
202+
cmap=[
203+
"Viridis",
204+
"Cividis",
205+
"Jet",
206+
"Plasma",
207+
"Inferno",
208+
"Magma",
209+
"Turbo",
210+
"RdBu",
211+
"BrBG",
212+
"PiYG",
213+
"PuOr",
214+
],
202215
height=800,
203216
node_size=[i * 0.125 for i in range(17)],
204217
)
@@ -235,7 +248,7 @@ def __init__(self, storage):
235248
self._init_clustering()
236249

237250
ui.button(
238-
"Run Mapper",
251+
"Run Mapper",
239252
on_click=self.async_run_mapper,
240253
color="primary",
241254
).classes("w-full")
@@ -568,10 +581,15 @@ async def async_run_mapper(self):
568581

569582

570583
@ui.page("/")
571-
def main():
584+
def main_page():
572585
ui.query(".nicegui-content").classes("p-0")
573586
storage = app.storage.client
574587
App(storage=storage)
575588

576589

577-
ui.run(storage_secret="secret")
590+
def main():
591+
ui.run(storage_secret="secret", title="tda-mapper-app", favicon=ICON_URL)
592+
593+
594+
if __name__ in ["__main__", "__mp_main__", "tdamapper.app"]:
595+
main()

0 commit comments

Comments
 (0)