Created
April 6, 2020 02:59
-
-
Save nicolasesnis/039cdee748b072bc977615e0bd51f23e to your computer and use it in GitHub Desktop.
This file contains 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
import plotly.graph_objects as go | |
import chart_studio.plotly as py | |
import plotly | |
fig = go.Figure(data=[go.Sankey( | |
node=dict( | |
thickness=10, # default is 20 | |
line=dict(color="black", width=0.5), | |
label=labels, | |
color=colors | |
), | |
link=dict( | |
source=sources, | |
target=targets, | |
value=values, | |
label=time_to_next, | |
hovertemplate='%{value} unique users went from %{source.label} to %{target.label}.<br />' + | |
'<br />It took them %{label} in average.<extra></extra>', | |
))]) | |
fig.update_layout(autosize=True, title_text="Medium app", font=dict(size=15), plot_bgcolor='white') | |
publish_to_web = True | |
if publish_to_web: | |
py.iplot(fig, filename='user_journey') | |
else: | |
fig.show(renderer='chrome') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment