Circos plot
Finally, you're going to make a Circos plot of the network!
Diese Übung ist Teil des Kurses
Introduction to Network Analysis in Python
Anleitung zur Übung
- Make a Circos plot of the network, again, with GitHub users sorted by their degree, and grouped and colored by their
'grouping'
key. To do this:- Iterate over all the nodes in
G
, including the metadata (by specifyingdata=True
). - In each iteration of the loop, calculate the degree of each node
n
withnx.degree()
and set its'degree'
attribute. - Create the
circos
plotc
by specifying three parameters in addition to the graphG
: thesort_by
argument, which is'degree'
, and thegroup_by
andnode_color_by
arguments, which are both'grouping'
. - Draw the
Circos
plot to the screen.
- Iterate over all the nodes in
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Import necessary modules
from nxviz import circos
import matplotlib.pyplot as plt
# Iterate over all the nodes, including the metadata
for n, d in ____:
# Calculate the degree of each node: G.node[n]['degree']
____ = ____
# Create the Circos plot: c
c = ____
# Draw the Circos plot to the screen
____
plt.show()