CommencerCommencer gratuitement

Visualizing using Arc plots

Following on what you've learned about the nxviz API, now try making an Arc plot of the network. Two keyword arguments that you will try here are sort_by='keyX' and node_color_by='keyX', in which you specify a key in the node metadata dictionary to color and order the nodes by.

matplotlib.pyplot has been imported for you as plt.

Cet exercice fait partie du cours

Introduction to Network Analysis in Python

Afficher le cours

Instructions

  • Import arc from nxviz.
  • Create an un-customized Arc plot of T. To do this, use the arc() function with just T as the argument.
  • Create another Arc plot of T in which the nodes are ordered and colored by the 'category' keyword. You'll have to specify the sort_by and node_color_by parameters to do this. For both plots, be sure to draw them to the screen and display them with plt.show().

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Import necessary modules
import matplotlib.pyplot as plt
____

# Create the un-customized Arc plot: a
a = ____

# Display the plot
plt.show()

# Create the customized Arc plot: a2
a2 = ____

# Display the plot
plt.show()
Modifier et exécuter le code