Untitled

 avatar
unknown
plain_text
2 years ago
742 B
7
Indexable
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D

# Define the function to plot
def func(x, y):
    return np.sin(np.sqrt(x**2 + y**2))

# Generate the x and y values
x = np.linspace(-10, 10, 100)
y = np.linspace(-10, 10, 100)
X, Y = np.meshgrid(x, y)

# Evaluate the function for each x, y pair
Z = func(X, Y)

# Define the list of points to plot
points = np.array([(2, 2, 2), (5, -5, 5), (-7, 7, -7), (8, 0, -8)])

# Create a 3D plot
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X, Y, Z, cmap='plasma')
ax.scatter(points[:, 0], points[:, 1], points[:, 2], color='black')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
plt.show()
Editor is loading...