We're updating the default styles for Matplotlib 2.0

Learn what to expect in the new updates


Previous topic

mplot3d example code: hist3d_demo.py

Next topic

mplot3d example code: lorenz_attractor.py

This Page

mplot3d example code: lines3d_demo.pyΒΆ

(Source code, png, hires.png, pdf)

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

mpl.rcParams['legend.fontsize'] = 10

fig = plt.figure()
ax = fig.gca(projection='3d')
theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
z = np.linspace(-2, 2, 100)
r = z**2 + 1
x = r * np.sin(theta)
y = r * np.cos(theta)
ax.plot(x, y, z, label='parametric curve')


Keywords: python, matplotlib, pylab, example, codex (see Search examples)