Skip to content

Instantly share code, notes, and snippets.

@Aditya1001001
Last active May 16, 2021 17:29
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 Aditya1001001/8226a5adc34455de69f1ad1fdf8385e2 to your computer and use it in GitHub Desktop.
Save Aditya1001001/8226a5adc34455de69f1ad1fdf8385e2 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d') # Create the axes
# Data
X = np.linspace(-8, 8, 100)
Y = np.linspace(-4, 4, 100)
X, Y = np.meshgrid(X, Y)
Z = X**2 + Y**2
# Plot the 3d surface
surface = ax.plot_surface(X, Y, Z,
cmap=cm.coolwarm,
rstride = 2,
cstride = 2)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment