LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Introduction to Network Analysis in Python

Kurs anzeigen

Anleitung zur Übung

  • 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().

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# 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()
Code bearbeiten und ausführen