50. Matplotlib: Adding contour lines to a heatmap

Here will will add contour lines to a heat map.

We’ll use something a little more interesting for the array of values, we’ll define a Mandlebrot fractal function. We have build a 1,000 and 1,000 array and calculate z as a Mandlebrot function of x and y.

The heatmap is drawn with plt.imshow, and then contour lines are added with plt.contour. Continue reading “50. Matplotlib: Adding contour lines to a heatmap”