Created
September 7, 2019 17:05
-
-
Save julian-west/3ce28ae7db651b2bb8fc9cd33b4f8d4d 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
#create minimum spanning tree layout from Gx (after small correlations have been removed) | |
mst = nx.minimum_spanning_tree(Gx) | |
edge_colours = [] | |
#assign edge colours | |
for key, value in nx.get_edge_attributes(mst, 'correlation').items(): | |
edge_colours.append(assign_colour(value)) | |
#draw minimum spanning tree. Set node size and width to constant | |
nx.draw(mst, with_labels=True, pos=nx.fruchterman_reingold_layout(mst), | |
node_size=200, node_color="#e1575c", edge_color=edge_colours, | |
width = 1.2) | |
#set title | |
plt.title("Asset price correlations - Minimum Spanning Tree",fontdict=font_dict) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment