scikit-tda / kepler-mapper

Kepler Mapper: A flexible Python implementation of the Mapper algorithm.
https://kepler-mapper.scikit-tda.org
MIT License
623 stars 180 forks source link

plotlyviz expects 1d color values, but gets 2d instead #225

Closed leemojiang closed 3 years ago

leemojiang commented 3 years ago

Plotlyviz in version 2.0 gives error,when using it in Jupyter.

To Reproduce plotlyviz(simplicial_complex, title="Dashboard plot", dashboard=True)

I downgraded to 1.4.1 and got the problem solved.

My environment

Python 3.7.4

detailed in the env.txt

Error message.

image

TypeError Traceback (most recent call last)

in 16 bgcolor=bgcolor, 17 y_gridcolor=y_gridcolor, ---> 18 member_textbox_width=600) 19 20 #Update the fw_graph colorbar, setting its title: /usr/local/lib/python3.7/site-packages/kmapper/plotlyviz.py in hovering_widgets(kmgraph, graph_fw, ctooltips, width, height, top, left, bgcolor, y_gridcolor, member_textbox_width) 647 left=left, 648 bgcolor=bgcolor, --> 649 y_gridcolor=y_gridcolor, 650 ) 651 clust_textbox = ipw.Text( /usr/local/lib/python3.7/site-packages/kmapper/plotlyviz.py in node_hist_fig(node_color_distribution, title, width, height, top, left, bottom, right, bgcolor, y_gridcolor) 538 text = [ 539 "{perc}%".format(**locals()) --> 540 for perc in [d["perc"] for d in node_color_distribution] 541 ] 542 /usr/local/lib/python3.7/site-packages/kmapper/plotlyviz.py in (.0) 538 text = [ 539 "{perc}%".format(**locals()) --> 540 for perc in [d["perc"] for d in node_color_distribution] 541 ] 542 TypeError: list indices must be integers or slices, not str
deargle commented 3 years ago

~I'm having trouble replicating: I just successfully ran https://github.com/scikit-tda/kepler-mapper/blob/master/docs/notebooks/Plotly-Demo.ipynb without error. Can you provide a reproducible example notebook?~

mb, I didn't run through the notebook far enough. I replicated.