Skip to content

Commit b1e907f

Browse files
committed
Fixed position of plotly menus in case of empty buttons
1 parent c7fc1a5 commit b1e907f

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

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 = "lucasimi90@gmail.com" }]

src/tdamapper/plot_backends/plot_plotly.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,11 +523,14 @@ def _set_ui(mapper_fig: go.Figure, plotly_ui: PlotlyUI) -> None:
523523
sliders = []
524524
x = 0.0
525525
if plotly_ui.menu_cmap:
526-
plotly_ui.menu_cmap["x"] = x
527-
x += 0.25
526+
if len(plotly_ui.menu_cmap["buttons"]) > 0:
527+
plotly_ui.menu_cmap["x"] = x
528+
x += 0.25
528529
menus.append(plotly_ui.menu_cmap)
529530
if plotly_ui.menu_color:
530-
plotly_ui.menu_color["x"] = x
531+
if len(plotly_ui.menu_color["buttons"]) > 0:
532+
plotly_ui.menu_color["x"] = x
533+
x += 0.25
531534
menus.append(plotly_ui.menu_color)
532535
if plotly_ui.slider_size:
533536
plotly_ui.slider_size["x"] = 0.0
@@ -569,7 +572,7 @@ def _update_cmap(cmap: str) -> dict:
569572

570573
return dict(
571574
buttons=buttons,
572-
x=0.25,
575+
x=0.0,
573576
xanchor="left",
574577
y=1.0,
575578
yanchor="top",

0 commit comments

Comments
 (0)