def plot(t, r, w, dx, dy, ph):
rx = np.arange(-r, r, w)
ry = np.arange(-r, r, w)
c = 1 if ph is None else 2
fig = plt.figure(figsize=(c * 9 - 4, 5))
fig.suptitle(t)
if ph is not None:
ax = fig.add_subplot(1, 2, 1, projection='3d')
x, y, z = np.meshgrid(rx, ry, 0)
ax.quiver(x, y, z, dx(x, y), dy(x, y), 0, length=w, color='red', normalize=True)
x, y = np.meshgrid(rx, ry)
ax.plot_surface(x, y, ph(x, y), cmap=plt.cm.bone)
ax = fig.add_subplot(1, c, c)
if ph is not None:
r2 = np.arange(-r, r, w / 4)
x, y = np.meshgrid(r2, r2)
cs1 = ax.contourf(x, y, ph(x, y), 10, cmap=plt.cm.bone)
#cs2 = ax.contour(cs1, colors='b')
cbar = plt.colorbar(cs1)
#cbar.add_lines(cs2)
x, y = np.meshgrid(rx, ry)
ax.quiver(x, y, dx(x, y), dy(x, y), color='red')