# How to Draw a 3D Plot Using Surface Plot

In this lesson, we will learn how to draw data in 3D using a surface plot.

We'll cover the following

In most cases, the two-dimensional image is the focus of our attention because the relationship between two variables is typically the focus of our research. However, cases arise where we need to explore the relationship among more than two variables, such as with the function $z=f(x,y)$.

Matplotlib provides many functions for drawing 3D plots. However, we will only focus on one of them in this course: the surface plot. A three-dimensional graph is essentially a plot of points in three dimensions, with data points that are triples $(x,y,z)$. A surface plot is like a wireframe plot, but each face of the wireframe is a filled polygon. We can also add a colormap to the surface plot, which can aid in the perception of the topology of the surface.

The basic function to plot a surface is plot_surface(). Below are some of its important parameters:

• X, Y, Z: 2D arrays, the data values.
• rcount, ccount: The maximum number of samples used in each direction. If the input data is large, it will downsample the data.
• cmap: Sets the colormap of the surface patches.
• color: Sets the color of the surface patches.
• norm: Sets the normalization for the colormap.

Get hands-on with 1200+ tech skills courses.