PLOTS imshowΒΆ

# -*-Python-*-
# Created by bgrierson at 21 Dec 2016  05:36

# imshow produces a contour like plot but shows the actual data as pixels

# Make some 2D data
nx = 21
nt = 11
x = linspace(0, 2, nx)
t = linspace(0, 1, nt)
tt, xx = meshgrid(t, x)
f = np.sin(2.0 * np.pi * (tt - 0.1 * (1.0 - xx)))

fig, ax = plt.subplots()
ax.imshow(f)
ax.set_title('Image default interpolation')
ax.set_xlabel('time pixel origin top')
ax.set_ylabel('x pixel origin left')

fig, ax = plt.subplots()
ax.imshow(f[::-1, :], extent=(np.min(t), np.max(t), np.min(x), np.max(x)), interpolation='nearest')
ax.contour(t, x, f)
ax.set_title('Image flipped, interp. nearest, and contour f(t,x)')
ax.set_xlabel('t axis')
ax.set_ylabel('x axis')