Skip to content

Instantly share code, notes, and snippets.

@DanHickstein
Created March 9, 2018 15:22
Show Gist options
  • Save DanHickstein/7b5ef8e8b244b0f05832141972126fc3 to your computer and use it in GitHub Desktop.
Save DanHickstein/7b5ef8e8b244b0f05832141972126fc3 to your computer and use it in GitHub Desktop.
import numpy as np
import scipy.ndimage
import matplotlib.pyplot as plt
before = np.zeros((10,10))
before[5] = 1
# after = np.rot90(before) # uncomment to switch to np.rot90s
after = scipy.ndimage.interpolation.rotate(before, 45)
fig, axs = plt.subplots(1, 2, figsize=(8,4))
axs[0].imshow(before)
axs[1].imshow(after)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment