HEAT MAPS
Listing 5.24 displays the contents of heatmap1.py that illustrates how to render a heat map based on random data values.
Listing 5.24: heatmap1.py
import numpy as np data = np.random.random((16, 16)) plt.imshow(data, cmap='tab20_r', interpolation='nearest') plt.show()
Listing 5.24 contains an import statement, followed by the variable data that is initialized as a 16x16 matrix of random values. The next code snippet renders the heat map, and the final code snippet displays the heat map. Launch the code in Listing 5.24 and you will see the following output:

In addition to the preceding data, you will also see the image that is shown in Figure 5.16.

FIGURE 5.16 A heat map from random data.