Created
September 7, 2019 17:09
-
-
Save julian-west/ca80206a4d1010b40a3cbf0382279ec1 to your computer and use it in GitHub Desktop.
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
# --------------------------------------- | |
# Plot graph | |
# --------------------------------------- | |
# edges | |
tracer = go.Scatter(x=Xedges, y=Yedges, | |
mode='lines', | |
line= dict(color='#DCDCDC', width=1), | |
hoverinfo='none', | |
showlegend=False) | |
# nodes | |
tracer_marker = go.Scatter(x=Xnodes, y=Ynodes, | |
mode='markers+text', | |
textposition='top center', | |
marker=dict(size=node_size, | |
line=dict(width=1), | |
color=node_colour), | |
hoverinfo='text', | |
hovertext=description, | |
text=node_label, | |
textfont=dict(size=7), | |
showlegend=False) | |
axis_style = dict(title='', | |
titlefont=dict(size=20), | |
showgrid=False, | |
zeroline=False, | |
showline=False, | |
ticks='', | |
showticklabels=False) | |
layout = dict(title='Plotly - interactive minimum spanning tree', | |
width=800, | |
height=800, | |
autosize=False, | |
showlegend=False, | |
xaxis=axis_style, | |
yaxis=axis_style, | |
hovermode='closest', | |
plot_bgcolor = '#fff') | |
fig = dict(data=[tracer, tracer_marker], layout=layout) | |
display(HTML("""<p>Node sizes are proportional to the size of annualised returns.<br> | |
Node colours signify positive or negative returns since beginning of the timeframe.</p> """)) | |
iplot(fig) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment