Created
October 28, 2018 14:28
-
-
Save hiramekun/5051cae05ed00422f1e26ebf4e9acc05 to your computer and use it in GitHub Desktop.
等高線を描くサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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