MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Introduction to Network Analysis in Python

Lihat Kursus

Petunjuk latihan

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

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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 dan Jalankan Kode