Here is the explanation for the preceding code:
- extended_image = np.zeros([100, 100], dtype="d") creates an 100 x 100 NumPy array filled with zeros, and specifies the data type as a double precision floating point.
- nx, ny = corr_wine.shape gets the shape of the correlation matrix into nx and ny.
- extended_image[25:25 + nx, 25:25 + ny] = corr_wine embeds the correlation matrix within a 100 x 100 zero matrix at the (25, 25) position, replacing zeros with values of corr_wine.
- extent = [-2, 2, -3, 1] specifies the data limits on the x (-2, 3) and y (-3, 1) coordinates for the main axes. Please refer to the recipe in Chapter 6, Plotting with Advanced Features, Origin and Extent, for more details.
- ax1.imshow(extended_image, extent=extent, ...