-
Notifications
You must be signed in to change notification settings - Fork 818
/
Copy pathcontour.py
31 lines (24 loc) · 854 Bytes
/
contour.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from pylab import *
def f(x,y): return (1-x/2+x**5+y**3)*np.exp(-x**2-y**2)
n = 256
x = np.linspace(-3,3,n)
y = np.linspace(-3,3,n)
X,Y = np.meshgrid(x,y)
contourf(X, Y, f(X,Y), 8, alpha=.75, cmap=cm.hot)
C = contour(X, Y, f(X,Y), 8, colors='black', linewidth=.5)
clabel(C, inline=1, fontsize=10)
xticks([]), yticks([])
text(-0.05, 1.05, " Contour Plot \n\n",
horizontalalignment='left',
verticalalignment='top',
family='Lint McCree Intl BB',
size='x-large',
bbox=dict(facecolor='white', alpha=1.0, width=350,height=60),
transform = gca().transAxes)
text(-0.05, .975, " Draw contour lines and filled contours ",
horizontalalignment='left',
verticalalignment='top',
family='Lint McCree Intl BB',
size='medium',
transform = gca().transAxes)
savefig('../figures/contour.png', dpi=64)