Skip to content

Instantly share code, notes, and snippets.

@banan314
Created November 4, 2018 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banan314/e29491d7fb8484855ab09bf7d3fc1cc9 to your computer and use it in GitHub Desktop.
Save banan314/e29491d7fb8484855ab09bf7d3fc1cc9 to your computer and use it in GitHub Desktop.
3D curve
import numpy as np
import matplotlib.pyplot as plt
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')
ax.legend()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment