Skip to content

Instantly share code, notes, and snippets.

@pzwang
Created February 16, 2016 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pzwang/f0bb4f3fcf0b3595331d to your computer and use it in GitHub Desktop.
Save pzwang/f0bb4f3fcf0b3595331d to your computer and use it in GitHub Desktop.
simple 2D plot of some data
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