Skip to content

Adapt the tutorial to the new mapper API#8

Merged
ulupo merged 8 commits intogiotto-ai:masterfrom
wreise:releaseModifs
Feb 26, 2020
Merged

Adapt the tutorial to the new mapper API#8
ulupo merged 8 commits intogiotto-ai:masterfrom
wreise:releaseModifs

Conversation

@wreise
Copy link
Copy Markdown
Contributor

@wreise wreise commented Jan 22, 2020

gtda.mappers.visualization:plot_static_mapper_graph has less flexibility regarding colors and the colormaps. Hence, the colors are updated directly on the figure.

@wreise wreise marked this pull request as ready for review January 22, 2020 11:17
@wreise wreise requested a review from lewtun January 22, 2020 11:19
@WeilerP
Copy link
Copy Markdown

WeilerP commented Jan 22, 2020

There are a few flake8 linting violations in the notebook. For consistency, these could (or should?) be resolved. For example:

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}

@WeilerP
Copy link
Copy Markdown

WeilerP commented Jan 22, 2020

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 utils.py file.

Copy link
Copy Markdown
Contributor

@ulupo ulupo left a 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!

@ulupo ulupo merged commit d682bac into giotto-ai:master Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants