In [1]:
import numpy as np
import matplotlib.pyplot as plt

length = 20

grid = np.ones((length, length), dtype=float)
x = np.arange(length)
y = np.arange(length)
grid[x, y] = 0.5
grid[x, y[::-1]] = 0.5
grid[x[::-1], y[::-1]] = 0.5
grid[x[::-1], y] = 0.5

x = range(length)
y = x

plt.contourf(x, y, grid, levels=[0, 0.25, 0.5, 0.75, 1., 1.25])
Out[1]:
<matplotlib.contour.QuadContourSet instance at 0x106b48248>
<matplotlib.figure.Figure at 0x10671c510>
In [2]:
plt.pcolormesh(grid)
Out[2]:
<matplotlib.collections.QuadMesh at 0x106b5fed0>
Back to top