Created
April 19, 2024 16:46
-
-
Save hyunjimoon/f918d549bf4c42898ca9bd80a0c68ad3 to your computer and use it in GitHub Desktop.
emergency_response
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
# Constants | |
x1, x2, y1, y2 = 1, 3, 2, 4 | |
# Grid of x, y points | |
x = np.linspace(0, 5, 400) | |
y = np.linspace(0, 5, 400) | |
X, Y = np.meshgrid(x, y) | |
Z = np.maximum(np.abs(X - x1) + np.abs(X - x2), np.abs(Y - y1) + np.abs(Y - y2)) | |
# Plot | |
fig = plt.figure() | |
ax = fig.add_subplot(111, projection='3d') | |
ax.plot_surface(X, Y, Z, cmap='viridis') | |
# Labels | |
ax.set_xlabel('X coordinate') | |
ax.set_ylabel('Y coordinate') | |
ax.set_zlabel('Z value') | |
plt.show() |
Author
hyunjimoon
commented
Apr 19, 2024
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment