Adapt the tutorial to the new mapper API#8
Merged
ulupo merged 8 commits intogiotto-ai:masterfrom Feb 26, 2020
Merged
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
ulupo
approved these changes
Feb 26, 2020
Contributor
ulupo
left a comment
There was a problem hiding this comment.
I removed some now unnecessary requirements, it should be ready to merge!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gtda.mappers.visualization:plot_static_mapper_graphhas less flexibility regarding colors and the colormaps. Hence, the colors are updated directly on the figure.