-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adapt the tutorial to the new mapper API #8
Conversation
There are a few plotly_kwargs = {'node_trace_marker_colorscale': None,
'node_trace_marker_showscale': False
} instead of plotly_kwargs = {'node_trace_marker_colorscale': None,
'node_trace_marker_showscale': False} |
If I am not mistaken, the following code is reused in almost all cells: # get cluster member indices
node_elements = graph["node_metadata"]["node_elements"]
# configure choice of layout (x,z values)
layout = np.array([np.mean(coords[el], axis=0)[[0, 2]] for el in node_elements])
# define node coloring
node_colors = np.array([data.loc[el, "color"].value_counts().index[0] for el in node_elements])
plotly_kwargs = {'node_trace_marker_colorscale': None,
'node_trace_marker_showscale': False
}
# initialise and display figure
fig = plot_static_mapper_graph(pipeline, coords,
layout, plotly_kwargs=plotly_kwargs)
fig.update_traces(patch={'hoverlabel_bgcolor': node_colors,
'marker_color': node_colors})
fig.show(config={'scrollZoom':True}) For readability, I think this part should be defined either once as a function in the notebook or in a separate |
…comply with PEP8(suggestions by WeilerP)
…n in the notebook
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed some now unnecessary requirements, it should be ready to merge!
gtda.mappers.visualization:plot_static_mapper_graph
has less flexibility regarding colors and the colormaps. Hence, the colors are updated directly on the figure.