A surface plot is a representation of a 3-D dataset. It shows the functional relationship between two independent variables such as X and Z and a designated dependent variable Y.

- It is said to be a companion plot to the contour plot.
- It is similar to a wireframe plot but in wireframe, each face is filled with a polygon.
- It is helpful in creating the topology of the surface which is begin visualized.

## Creating 3-D surface Plot

To create 3-D surface plot ax.plot_surface() function is used

### Syntax

`ax.plot_surface(X, Y, Z)`

Here, X and Y are 2-D arrays of points while Z is the 2-D array of heights.

Some of the attributes are given below:

**facecolor:**It is used to represent the face colour of the individual surface.**shade:**It is used to shade the face colour.**color:**It is used to represent the colour of the surface.**vmax:**It is used to represent the maximum value of the map.**vmin:**It is used to represent the minimum value of the map.**cmap:**It is used to represent the colormap of the surface.**nrom:**It acts as an instance to normalize the values of color map.**rcount:**It is used to represent the number of rows to be used. By default it is set to 50.**ccount:**It is used to represent the number of columns to be used. By default it is set to 50.**rstride:**It is used to represent the array of row stride(that is step size).**cstride:**It is used to represent the array of column stride(that is step size).

### Example

```
from mpl_toolkits import mplot3d
import numpy as np
import matplotlib.pyplot as plt
a=np.outer(np.linspace(-2,6,10),np.ones(10))
b=a.copy().T
c=(np.cos(a)+np.cos(b))
fig = plt.figure()
ax = plt.axes(projection ='3d')
ax.plot_surface(a,b,c)
plt.show()
```

**Output**

- Log in to post comments