Skip to content

Instantly share code, notes, and snippets.

@linnil1
Last active May 3, 2018 07:40
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 linnil1/25bff8366d62f719479210b3bedf1dfe to your computer and use it in GitHub Desktop.
Save linnil1/25bff8366d62f719479210b3bedf1dfe to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import numpy as np
bound = 2
r = np.linspace(-bound, bound, 20)
x, y = np.meshgrid(r, r)
vx = x
vy = x * (x - 1) * (y + 1)
plt.figure(figsize=(10, 8))
Q = plt.quiver(x, y, vx, vy)
plt.xlim([-bound, bound])
plt.ylim([-bound, bound])
tx = np.linspace(-bound, bound)
txx, tc = np.meshgrid(tx, np.linspace(-5, 1, 10))
ty = np.exp(txx ** 2 / 2 - txx + tc) - 1
plt.plot(txx.T, ty.T)
plt.plot(txx.T, -ty.T - 2)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment