CUBED NUMBERS IN MATPLOTLIB
Listing 5.4 displays the content of cubed_numbers.py that illustrates how to plot a set of points using Matplotlib.
LISTING 5.4: cubed_numbers.py
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4], [1, 8, 27, 64])
plt.axis([0, 5, 0, 70])
plt.xlabel("Integers (1-4)")
plt.ylabel("Cubed Integers")
plt.show()
Listing 5.4 plots a set of integer-valued points whose x-coordinate is between 1 and 4, inclusive, and whose y-coordinate is the cube of the corresponding x-coordinate. The code sample also labels the horizontal axis and the vertical axis. Figure 5.1 displays these points in Listing 5.4.

FIGURE 5.1 A graph of cubed numbers