What's New 0.99 Mplot3dΒΆ

Create a 3D surface plot.

import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D

X = np.arange(-5, 5, 0.25)
Y = np.arange(-5, 5, 0.25)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R)

fig = plt.figure()
ax = Axes3D(fig, auto_add_to_figure=False)
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.viridis)

whats new 99 mplot3d


The use of the following functions, methods, classes and modules is shown in this example:

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery