Get startedGet started for free

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.

This exercise is part of the course

Introduction to Network Analysis in Python

View Course

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

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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()
Edit and Run Code