Skip to content

Instantly share code, notes, and snippets.

@juice500ml
Created February 10, 2022 09:23
Show Gist options
  • Save juice500ml/03dd5941b1e1bb3b0d6a43751e4adccb to your computer and use it in GitHub Desktop.
Save juice500ml/03dd5941b1e1bb3b0d6a43751e4adccb to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(figsize=(5, 5))
ax = fig.add_subplot(projection='3d')
k = 500
z = np.arange(0, k)
ax.scatter(
xs=np.cos(z/10) * (k-z) * 0.5,
ys=np.sin(z/10) * (k-z) * 0.5,
zs=z,
c=['red' if x == 0 else ('blue' if x == 4 else 'green')
for x in np.mod(z, 8)]
)
ax.scatter(
xs=0, ys=0, zs=520, c='yellow', s=400, marker='*'
)
ax.scatter(
xs=np.random.randint(-k*2, k*2, 200),
ys=np.random.randint(-k*2, k*2, 200),
zs=np.random.randint(0, k, 200),
c='gray',
)
ax.set_xlim(-k, k)
ax.set_ylim(-k, k)
ax.set_title('Merry Christmas! (GMT-8)')
plt.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment