matplotlib
Fork me on GitHub


Travis-CI:

Related Topics

This Page

Parametric CurveΒΆ

This example demonstrates plotting a parametric curve in 3D.

../../_images/sphx_glr_lines3d_001.png
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')

# Prepare arrays x, y, z
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')
ax.legend()

plt.show()

Total running time of the script: ( 0 minutes 0.012 seconds)

Gallery generated by Sphinx-Gallery