Skip to content

Instantly share code, notes, and snippets.

@hiramekun
Created October 28, 2018 14:28
Show Gist options
  • Save hiramekun/5051cae05ed00422f1e26ebf4e9acc05 to your computer and use it in GitHub Desktop.
Save hiramekun/5051cae05ed00422f1e26ebf4e9acc05 to your computer and use it in GitHub Desktop.
等高線を描くサンプル
def draw_contour(target):
n = 100
x = np.linspace(-5, 5, n)
y = np.linspace(-5, 5, n)
X, Y = np.meshgrid(x, y)
Z = target([X, Y])
plt.gca().set_aspect('equal')
plt.contour(X, Y, Z, levels=np.linspace(0, 200, 15))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment