Skip to content

Instantly share code, notes, and snippets.

@deanputney
Created February 11, 2025 19:01
Show Gist options
  • Save deanputney/d563be76e5c08f2e71f5875f6ce609e0 to your computer and use it in GitHub Desktop.
Save deanputney/d563be76e5c08f2e71f5875f6ce609e0 to your computer and use it in GitHub Desktop.
Twilight Matplotlib
## From: https://www.reddit.com/r/generative/comments/1imyi7b/comment/mc6vx7c/
#!/usr/bin/env python3
# coding: utf-8
import matplotlib.pyplot as plt
import numpy as np
def main():
X, Y = np.meshgrid(
np.linspace(-1, 1, 500),
np.linspace(-1, 1, 500))
Z = np.floor(4 * (X+Y)) + np.arcsinh(8 *1j * (X-Y))
plt.figure()
off = 1/15
plt.subplots_adjust(left=off, right=1-off,
bottom=off, top=1-off)
plt.imshow(np.real(Z), cmap='twilight')
plt.axis("off")
plt.show()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment