Skip to content

Commit 1fbbe3c

Browse files
committed
more contour patches applied
svn path=/trunk/matplotlib/; revision=1057
1 parent 50632d2 commit 1fbbe3c

14 files changed

+1200
-543
lines changed

CHANGELOG

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
New entries should be added at the top
22

3+
2005-03-09 Added Eric's contourf updates and Nadia's clabel functionality
4+
- TODO, factor clabel into a dedicated class
5+
36
2005-03-09 Moved colorbar to figure.Figure to expose it for API developers
4-
- JDH
7+
- JDH
58

69
2005-03-09 backend_cairo.py: implemented draw_markers() - SC
710

MANIFEST

+19
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ NUMARRAY_ISSUES
1010
README
1111
TODO
1212
__init__.py
13+
makeswig.py
1314
setup.py
1415
setupext.py
1516
CXX/Config.hxx
@@ -247,6 +248,7 @@ agg22/svg/win32_api/svg_test.dsp
247248
agg22/svg/win32_api/svg_test.dsw
248249
examples/README
249250
examples/__init__.py
251+
examples/_tmp_simple_plot.py
250252
examples/accented_text.py
251253
examples/agg_oo.py
252254
examples/alignment_test.py
@@ -266,6 +268,7 @@ examples/color_demo.py
266268
examples/colours.py
267269
examples/contour_demo.py
268270
examples/contour_demo2.py
271+
examples/contourf_demo.py
269272
examples/coords_demo.py
270273
examples/coords_report.py
271274
examples/csd_demo.py
@@ -381,6 +384,7 @@ examples/data/ct.raw
381384
examples/data/eeg.dat
382385
examples/data/embedding_in_wx3.xrc
383386
examples/data/intc.csv
387+
examples/data/lena.jpg
384388
examples/data/membrane.dat
385389
examples/data/msft.csv
386390
examples/data/s1045.ima
@@ -506,12 +510,14 @@ lib/dateutil/rrule.py
506510
lib/dateutil/tz.py
507511
lib/matplotlib/.cvsignore
508512
lib/matplotlib/__init__.py
513+
lib/matplotlib/__init__.py.~1.41.~
509514
lib/matplotlib/_contour.py
510515
lib/matplotlib/_image.py
511516
lib/matplotlib/_mathtext_data.py
512517
lib/matplotlib/_pylab_helpers.py
513518
lib/matplotlib/_transforms.py
514519
lib/matplotlib/afm.py
520+
lib/matplotlib/agg.py
515521
lib/matplotlib/artist.py
516522
lib/matplotlib/axes.py
517523
lib/matplotlib/axis.py
@@ -522,16 +528,19 @@ lib/matplotlib/collections.py
522528
lib/matplotlib/colors.py
523529
lib/matplotlib/dates.py
524530
lib/matplotlib/figure.py
531+
lib/matplotlib/figure.py.~1.16.~
525532
lib/matplotlib/finance.py
526533
lib/matplotlib/font_manager.py
527534
lib/matplotlib/image.py
528535
lib/matplotlib/legend.py
529536
lib/matplotlib/lines.py
537+
lib/matplotlib/lines.py.~1.23.~
530538
lib/matplotlib/mathtext.py
531539
lib/matplotlib/mlab.py
532540
lib/matplotlib/patches.py
533541
lib/matplotlib/path.py
534542
lib/matplotlib/pylab.py
543+
lib/matplotlib/pylab.py.~1.45.~
535544
lib/matplotlib/pyparsing.py
536545
lib/matplotlib/table.py
537546
lib/matplotlib/text.py
@@ -606,11 +615,13 @@ lib/matplotlib/enthought/traits/ui/null/rgba_color_trait.py
606615
lib/matplotlib/enthought/traits/ui/null/toolkit.py
607616
lib/matplotlib/enthought/util/__init__.py
608617
lib/matplotlib/enthought/util/resource.py
618+
lib/matplotlib/numerix/.cvsignore
609619
lib/matplotlib/numerix/__init__.py
610620
lib/matplotlib/numerix/_na_imports.py
611621
lib/matplotlib/numerix/_nc_imports.py
612622
lib/matplotlib/numerix/fft/__init__.py
613623
lib/matplotlib/numerix/linear_algebra/__init__.py
624+
lib/matplotlib/numerix/ma/__init__.py
614625
lib/matplotlib/numerix/mlab/__init__.py
615626
lib/matplotlib/numerix/random_array/__init__.py
616627
lib/pytz/__init__.py
@@ -1189,6 +1200,7 @@ license/DATEUTIL_LICENSE.txt
11891200
license/LICENSE
11901201
license/LICENSE_PAINT
11911202
license/LICENSE_PIL
1203+
license/LICENSE_enthought.txt
11921204
license/PYTZ_LICENSE.txt
11931205
src/_backend_agg.cpp
11941206
src/_backend_agg.h
@@ -1208,8 +1220,15 @@ src/_tkagg.cpp
12081220
src/_transforms.cpp
12091221
src/_transforms.h
12101222
src/_windowing.cpp
1223+
src/agg.cxx
12111224
src/ft2font.cpp
12121225
src/ft2font.h
12131226
src/gcntr.c
12141227
src/mplutils.cpp
12151228
src/mplutils.h
1229+
src/swig_runtime.h
1230+
swig/agg.i
1231+
swig/agg_basics.i
1232+
swig/agg_path_storage.i
1233+
swig/agg_trans_affine.i
1234+
swig/agg_typemaps.i

TODO

+3
Original file line numberDiff line numberDiff line change
@@ -661,3 +661,6 @@ ZeroDivisionError: SeparableTransformation::eval_scalars yin interval is zero; c
661661
the backend, eg ps symbol formatting
662662

663663
-- add gc warning to oo agg and FAQ
664+
665+
-- check why lowest contour is not labeled in contour_demo2 and why
666+
the colormap is still not applying to the contour.

boilerplate.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def %(func)s(*args, **kwargs):
2424
%(mappable)s
2525
hold(b)
2626
return ret
27-
%(func)s.__doc__ = Axes.%(func)s.__doc__ + \"\"\"
27+
%(func)s.__doc__ = _shift_string(Axes.%(func)s.__doc__) + \"\"\"
2828
Addition kwargs: hold = [True|False] overrides default hold state\"\"\"
2929
"""
3030

@@ -36,7 +36,7 @@ def %(func)s(*args, **kwargs):
3636
ret = gca().%(func)s(*args, **kwargs)
3737
draw_if_interactive()
3838
return ret
39-
%(func)s.__doc__ = Axes.%(func)s.__doc__
39+
%(func)s.__doc__ = _shift_string(Axes.%(func)s.__doc__)
4040
"""
4141

4242
# these methods are all simple wrappers of Axes methods by the same
@@ -49,6 +49,7 @@ def %(func)s(*args, **kwargs):
4949
'bar',
5050
'barh',
5151
'cohere',
52+
'clabel',
5253
'contour',
5354
'contourf',
5455
'csd',

examples/contour_demo.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
linewidths=arange(.5, 4, .5),
1717
colors=('r', 'green', 'blue', (1,1,0), '#afeeee', 0.5),
1818
origin='lower')
19-
legend(loc='lower left')
19+
clabel(colls,levels,fontsize=7, inline=1)
20+
#clabel(colls)
21+
2022
savefig('test')
2123
show()
2224

examples/contour_demo2.py

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# difference of Gaussians
1313
im = imshow(Z2-Z1, interpolation='bilinear', cmap=cm.gray, extent=(-3,3,-2,2))
1414
levels, colls = contour(X, Y, Z2-Z1, linewidths=2)
15+
clabel(colls, inline=1,fontsize=8)
1516
colorbar()
1617
hot()
1718
savefig('test')

examples/fill_between_posneg.py

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/env python
2+
"""
3+
From: James Boyle <boyle5@llnl.gov>
4+
Subject: possible candidate for examples directory using fill
5+
To: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
6+
Date: Tue, 8 Mar 2005 15:44:11 -0800
7+
8+
I often compare the output from two sensors and I am interested in the
9+
sign of the differences.
10+
11+
I wrote the enclosed code for find the polygons of the positive and
12+
negative regions of the difference of two curves. It is written for
13+
simple-minded straightforwardness rather than speed or elegance.
14+
It is easy to fill in the two sets of polygons with contrasting colors.
15+
For efficiency one could use collections but my curves are such that
16+
fill is quick enough.
17+
18+
The code uses a simple linear technique to find the crossover point,
19+
this too could be made more sophisticated if one desired.
20+
21+
I have found this code to be very handy for the comparisons I perform
22+
-
23+
maybe someone else would find it useful.
24+
25+
--Jim
26+
"""
27+
28+
#!/usr/bin/env python
29+
30+
from pylab import *
31+
32+
x1 = arange(0, 2, 0.01)
33+
y1 = sin(2*pi*x1)
34+
y2 = sin(4*pi*x1)
35+
36+
# find positive and negative polygons of difference
37+
pos,neg = posNegFill(x1,y1,y2)
38+
# positive y2 > y1 is blue
39+
for x,y in pos:
40+
p = fill(x,y,'b')
41+
42+
# negative Y2 < y1 is red
43+
for x,y in neg:
44+
p = fill(x,y,'r')
45+
46+
47+
48+
def posNegFill(x,y1,y2):
49+
diff = y2 - y1
50+
pos = []
51+
neg = []
52+
xx1 = [x[0]]
53+
xx2 = [x[0]]
54+
yy1 = [y1[0]]
55+
yy2 = [y2[0]]
56+
oldSign = (diff[0] < 0 )
57+
npts = x.shape[0]
58+
for i in range(1,npts):
59+
newSign = (diff[i] < 0)
60+
if newSign != oldSign:
61+
xz,yz = findZero(i,x,y1,y2)
62+
xx1.append(xz)
63+
yy1.append(yz)
64+
xx2.reverse()
65+
xx1.extend(xx2)
66+
yy2.reverse()
67+
yy1.extend(yy2)
68+
if oldSign:
69+
neg.append( (xx1,yy1) )
70+
else:
71+
pos.append( (xx1,yy1) )
72+
xx1 = [xz,x[i]]
73+
xx2 = [xz,x[i]]
74+
yy1 = [yz,y1[i]]
75+
yy2 = [yz,y2[i]]
76+
oldSign = newSign
77+
else:
78+
xx1.append( x[i])
79+
xx2.append( x[i])
80+
yy1.append(y1[i])
81+
yy2.append(y2[i])
82+
if i == npts-1:
83+
xx2.reverse()
84+
xx1.extend(xx2)
85+
yy2.reverse()
86+
yy1.extend(yy2)
87+
if oldSign :
88+
neg.append( (xx1,yy1) )
89+
else:
90+
pos.append( (xx1,yy1) )
91+
return pos,neg
92+
93+
def findZero(i,x,y1,y2):
94+
im1 = i-1
95+
m1 = (y1[i] - y1[im1])/(x[i] - x[im1])
96+
m2 = (y2[i] - y2[im1])/(x[i] - x[im1])
97+
b1 = y1[im1] - m1*x[im1]
98+
b2 = y2[im1] - m2*x[im1]
99+
xZero = (b1 - b2)/(m2 - m1)
100+
yZero = m1*xZero + b1
101+
return (xZero, yZero)
102+
103+
show()

lib/matplotlib/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
"""
142142
from __future__ import generators
143143

144-
__version__ = '0.73'
144+
__version__ = '0.73rc1'
145145
__revision__ = '$Revision$'
146146
__date__ = '$Date$'
147147

0 commit comments

Comments
 (0)