Skip to content

Commit 4823bef

Browse files
committed
added Erics contourf patch
svn path=/trunk/matplotlib/; revision=987
1 parent 307a753 commit 4823bef

File tree

9 files changed

+1449
-1136
lines changed

9 files changed

+1449
-1136
lines changed

CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
New entries should be added at the top
22

3-
3+
2005-03-01 Added Eric's contourf routines
44

55
2005-03-01 Added start of proper agg SWIG wrapper. I would like to
66
expose agg functionality directly a the user level and this

boilerplate.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def %(func)s(*args, **kwargs):
2626
return ret
2727
%(func)s.__doc__ = Axes.%(func)s.__doc__ + \"\"\"
2828
Addition kwargs: hold = [True|False] overrides default hold state\"\"\"
29-
"""
29+
"""
3030

3131
_fmtmisc = """\
3232
# This function was autogenerated by boilerplate.py. Do not edit as
@@ -37,10 +37,10 @@ def %(func)s(*args, **kwargs):
3737
draw_if_interactive()
3838
return ret
3939
%(func)s.__doc__ = Axes.%(func)s.__doc__
40-
"""
40+
"""
4141

4242
# these methods are all simple wrappers of Axes methods by the same
43-
# name.
43+
# name.
4444
_plotcommands = (
4545
'axhline',
4646
'axhspan',
@@ -49,7 +49,8 @@ def %(func)s(*args, **kwargs):
4949
'bar',
5050
'barh',
5151
'cohere',
52-
'contour',
52+
'contour',
53+
'contourf',
5354
'csd',
5455
'errorbar',
5556
'fill',
@@ -59,7 +60,7 @@ def %(func)s(*args, **kwargs):
5960
'loglog',
6061
'pcolor',
6162
'pcolor_classic',
62-
'pie',
63+
'pie',
6364
'plot',
6465
'plot_date',
6566
'psd',
@@ -84,10 +85,11 @@ def %(func)s(*args, **kwargs):
8485

8586
cmappable = {
8687
'contour' : 'if ret[1].mappable is not None: gci._current = ret[1].mappable',
88+
'contourf': 'if ret[1].mappable is not None: gci._current = ret[1].mappable',
8789
'scatter' : 'gci._current = ret',
8890
'pcolor' : 'gci._current = ret',
8991
'imshow' : 'gci._current = ret',
90-
'spy2' : 'gci._current = ret',
92+
'spy2' : 'gci._current = ret',
9193
'specgram' : 'gci._current = ret[-1]',
9294

9395
}

examples/backend_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def drive(backend, python='python2.3'):
106106
#backends = ['Agg', 'Cairo', 'GDK', 'PS', 'SVG', 'Template']
107107
backends = ['Agg', 'PS', 'SVG', 'Template']
108108
#backends = [ 'GTK', 'WX', 'TkAgg']
109-
backends = ['PS']
109+
#backends = ['PS']
110110
python = 'python2.3'
111111
for backend in backends:
112112
print 'testing %s' % backend

examples/contourf_demo.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env python
2+
from pylab import *
3+
4+
origin = 'lower'
5+
#origin = 'upper'
6+
7+
delta = 0.5 #0.025
8+
x = y = arange(-3.0, 3.01, delta)
9+
X, Y = meshgrid(x, y)
10+
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
11+
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
12+
Z = Z1 - Z2
13+
14+
if 0:
15+
badmask = zeros(shape(Z))
16+
17+
badmask[5,5] = 1
18+
badmask[5,6] = 1
19+
Z[5,5] = 0
20+
Z[5,6] = 0
21+
22+
badmask[0,0] = 1
23+
Z[0,0] = 0
24+
25+
levels, colls = contourf(X, Y, Z, 10, # [-1, -0.1, 0, 0.1],
26+
# badmask=badmask,
27+
#alpha=0.5,
28+
cmap=bone(),
29+
origin=origin)
30+
31+
levs2, colls2 = contour(X, Y, Z, levels,
32+
# badmask=badmask,
33+
colors = 'r',
34+
origin=origin,
35+
hold='on')
36+
savefig('test')
37+
show()
38+

0 commit comments

Comments
 (0)