Created
December 23, 2023 17:58
-
-
Save ydm/477d27ac5d9d9a983fdf4924ed111ceb to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
import numpy as np | |
from matplotlib import cm | |
from matplotlib import pyplot as plt | |
xs, ys = np.meshgrid( | |
np.linspace(1/1000, 1, 999), | |
np.linspace(1/1000, 1, 999), | |
) | |
zs = [] | |
for x, y in zip(xs.ravel(), ys.ravel()): | |
z = (x - y) / (x + y) | |
zs.append(z) | |
zs = np.array(zs).reshape(xs.shape) | |
fig = plt.figure(figsize=(24, 24)) | |
ax = plt.axes(projection='3d') | |
ax.plot_surface(xs, ys, zs, cmap=cm.coolwarm_r) | |
ax.set_xlabel('First') | |
ax.set_ylabel('Second') | |
ax.set_zlabel('Difference') | |
ax.view_init(30, 220) | |
plt.savefig('3d.png') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment