[ Web Proxy ]
URL:
Viewing: https://matplotlib.org/stable/api/_as_gen/../../gallery/scales/../showcase/../mplot3d/lines3d.html [Back]  [Original]

Parametric curve — Matplotlib 3.11.2 documentation
Back to top
Search the docs ...:

Parametric curve#

This example demonstrates plotting a parametric curve in 3D.

import matplotlib.pyplot as plt
import numpy as np

ax = plt.figure().add_subplot(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()
lines3d [lines3d]

Tags: plot-type: 3D level: beginner

Gallery generated by Sphinx-Gallery


Web Proxy Viewer  |  New URL  |  Original Page