Skip to content

Commit c688996

Browse files
committed
Fixed vanishing colormap title
1 parent 2ad4dd4 commit c688996

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/tdamapper/plot_backends/plot_plotly.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,20 +460,17 @@ def _colorbar(title: str) -> dict:
460460
showticklabels=True,
461461
outlinewidth=1,
462462
borderwidth=0,
463-
orientation="v",
464-
thickness=0.025,
465463
thicknessmode="fraction",
466464
xanchor="left",
467465
title_side="right",
466+
title_text=title,
468467
ypad=0,
469468
xpad=0,
470469
tickwidth=1,
471470
tickformat=".2g",
472471
nticks=_TICKS_NUM,
473472
tickmode="auto",
474473
)
475-
if title is not None:
476-
cbar["title"] = title
477474
return cbar
478475

479476

@@ -521,7 +518,7 @@ def _layout() -> go.Layout:
521518
title="",
522519
)
523520
return go.Layout(
524-
plot_bgcolor="rgba(0, 0, 0, 0)",
521+
template="plotly",
525522
autosize=True,
526523
height=None,
527524
width=None,
@@ -641,7 +638,10 @@ def _update_colors(i: int) -> dict:
641638
if mapper_plot.dim == 2:
642639
return {
643640
"text": [scatter_text],
644-
"marker.colorbar": [cbar],
641+
**{
642+
f"marker.colorbar.{'.'.join(k.split('_'))}": [v]
643+
for k, v in cbar.items()
644+
},
645645
"marker.color": [node_col_arr],
646646
"marker.cmax": [max(node_col_arr, default=None)],
647647
"marker.cmin": [min(node_col_arr, default=None)],
@@ -653,7 +653,10 @@ def _update_colors(i: int) -> dict:
653653
)
654654
return {
655655
"text": [None, scatter_text],
656-
"marker.colorbar": [None, cbar],
656+
**{
657+
f"marker.colorbar.{'.'.join(k.split('_'))}": [None, v]
658+
for k, v in cbar.items()
659+
},
657660
"marker.color": [None, node_col_arr],
658661
"marker.cmax": [None, max(node_col_arr, default=None)],
659662
"marker.cmin": [None, min(node_col_arr, default=None)],

0 commit comments

Comments
 (0)