We learned how to draw a 2D contour plot in Chapter 2, Getting Started with Basic Plots. Here, we will learn how to draw it in 3D. We will use the same data that we used earlier, so that we can see the difference between 2D and 3D visualization.
Contour plot
Getting ready
Import the required libraries:
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib import cm
How to do it...
Here are the steps to create the desired plot:
- Define the figure and axes for 3D plotting:
fig = plt.figure(figsize=(10,8))
ax = fig.gca(projection...