PLOTTING MULTIPLE LINES IN MATPLOTLIB
Listing 5.15 displays the content of plt_array2.py that illustrates the ease with which you can plot multiple lines in Matplotlib.
LISTING 5.15: plt_array2.py
import matplotlib.pyplot as plt x = [7,11,13,15,17,19,23,29,31,37] data = [[8, 4, 1], [5, 3, 3], [6, 0, 2], [1, 7, 9]] plt.plot(data, 'd-') plt.show()
Listing 5.15 defines the array data that contains a hard-coded set of values. The Pyplot API plot() uses the variable data to display a line segment. Figure 5.12 displays multiple lines based on the code in Listing 5.15.

FIGURE 5.12 Multiple lines in Matplotlib