Created
February 16, 2016 19:56
-
-
Save pzwang/f0bb4f3fcf0b3595331d to your computer and use it in GitHub Desktop.
simple 2D plot of some data
This file contains hidden or 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 | |
# Create some dummy data (a 2D cosine function) and scale it to 255 | |
xs, ys = np.meshgrid(np.linspace(-5,5,500), np.linspace(-5,5,500), | |
indexing = "xy") | |
data = np.cos(np.sqrt(xs*xs + ys*ys)) * 255 | |
image = plt.imshow(data, cmap="ocean") | |
plt.colorbar() | |
plt.savefig("temp.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment