Skip to content

Commit 5bb54e0

Browse files
committed
added hist bin fix
svn path=/trunk/matplotlib/; revision=1433
1 parent 24be976 commit 5bb54e0

File tree

14 files changed

+130
-31
lines changed

14 files changed

+130
-31
lines changed

.matplotlibrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ tick.major.size : 4 # major tick size in points
148148
tick.minor.size : 2 # minor tick size in points
149149
tick.major.pad : 4 # distance to major tick label in points
150150
tick.minor.pad : 4 # distance to the minor tick label in points
151-
tick.color : black # color of the tick labels
152-
tick.labelsize : 10 # fontsize of the tick labels
151+
tick.color : k # color of the tick labels
152+
tick.labelsize : 12 # fontsize of the tick labels
153153

154154
### Grids
155155
grid.color : black # grid color

API_CHANGES

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
API CHANGES in matplotlib-0.81.1
2+
3+
Sean Richards notes there was a problem in the way we created the
4+
binning for histogram, which made the last bin underrepresented.
5+
From his post
6+
7+
I see that hist uses the linspace function to create the bins and
8+
then uses searchsorted to put the values in their correct
9+
bin. Thats all good but I am confused over the use of linspace for
10+
the bin creation. I wouldn't have thought that it does what is
11+
needed, to quote the docstring it creates a "Linear spaced array
12+
from min to max". For it to work correctly shouldn't the values in
13+
the bins array be the same bound for each bin? (i.e. each value
14+
should be the lower bound of a bin). To provide the correct bins
15+
for hist would it not be something like
16+
17+
def bins(xmin, xmax, N):
18+
if N==1: return xmax
19+
dx = (xmax-xmin)/N # instead of N-1
20+
return xmin + dx*arange(N)
21+
22+
23+
This suggestion in implemented in 0.81. My test script with these
24+
changes does not reveal any bias in the binning
25+
26+
from matplotlib.numerix.mlab import randn, rand, zeros, Float
27+
from matplotlib.mlab import hist, mean
28+
29+
Nbins = 50
30+
Ntests = 200
31+
results = zeros((Ntests,Nbins), typecode=Float)
32+
for i in range(Ntests):
33+
print 'computing', i
34+
x = rand(10000)
35+
n, bins = hist(x, Nbins)
36+
results[i] = n
37+
print mean(results)
38+
39+
40+
141
API CHANGES in matplotlib-0.81
242

343

CHANGELOG

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

3-
2005-06-07 Fixed a bug in texmanager.py: .aux files not being removed - DSD
3+
4+
2005-06-08 Added Sean Richard's hist binning fix -- see API_CHANGES - JDH
5+
6+
2005-06-07 Fixed a bug in texmanager.py: .aux files not being removed
7+
- DSD
8+
9+
================================================================
10+
11+
2005-06-07 matplotlib-0.81 released
412

513
2005-06-06 Added autoscale_on prop to axes
614

LICENSE/LICENSE

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LICENSE AGREEMENT FOR MATPLOTLIB 0.80
1+
LICENSE AGREEMENT FOR MATPLOTLIB 0.81
22
--------------------------------------
33

44
1. This LICENSE AGREEMENT is between John D. Hunter ("JDH"), and the
@@ -9,30 +9,30 @@ documentation.
99
2. Subject to the terms and conditions of this License Agreement, JDH
1010
hereby grants Licensee a nonexclusive, royalty-free, world-wide license
1111
to reproduce, analyze, test, perform and/or display publicly, prepare
12-
derivative works, distribute, and otherwise use matplotlib 0.80
12+
derivative works, distribute, and otherwise use matplotlib 0.81
1313
alone or in any derivative version, provided, however, that JDH's
1414
License Agreement and JDH's notice of copyright, i.e., "Copyright (c)
1515
2002-2005 John D. Hunter; All Rights Reserved" are retained in
16-
matplotlib 0.80 alone or in any derivative version prepared by
16+
matplotlib 0.81 alone or in any derivative version prepared by
1717
Licensee.
1818

1919
3. In the event Licensee prepares a derivative work that is based on or
20-
incorporates matplotlib 0.80 or any part thereof, and wants to
20+
incorporates matplotlib 0.81 or any part thereof, and wants to
2121
make the derivative work available to others as provided herein, then
2222
Licensee hereby agrees to include in any such work a brief summary of
23-
the changes made to matplotlib 0.80.
23+
the changes made to matplotlib 0.81.
2424

25-
4. JDH is making matplotlib 0.80 available to Licensee on an "AS
25+
4. JDH is making matplotlib 0.81 available to Licensee on an "AS
2626
IS" basis. JDH MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
2727
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, JDH MAKES NO AND
2828
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
29-
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 0.80
29+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 0.81
3030
WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
3131

3232
5. JDH SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB
33-
0.80 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR
33+
0.81 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR
3434
LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING
35-
MATPLOTLIB 0.80, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF
35+
MATPLOTLIB 0.81, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF
3636
THE POSSIBILITY THEREOF.
3737

3838
6. This License Agreement will automatically terminate upon a material
@@ -44,6 +44,6 @@ Licensee. This License Agreement does not grant permission to use JDH
4444
trademarks or trade name in a trademark sense to endorse or promote
4545
products or services of Licensee, or any third party.
4646

47-
8. By copying, installing or otherwise using matplotlib 0.80,
47+
8. By copying, installing or otherwise using matplotlib 0.81,
4848
Licensee agrees to be bound by the terms and conditions of this License
4949
Agreement.

MANIFEST

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,54 +178,92 @@ agg23/src/ChangeLog
178178
agg23/src/Makefile
179179
agg23/src/Makefile.am
180180
agg23/src/agg_arc.cpp
181+
agg23/src/agg_arc.o
181182
agg23/src/agg_arrowhead.cpp
183+
agg23/src/agg_arrowhead.o
182184
agg23/src/agg_bezier_arc.cpp
185+
agg23/src/agg_bezier_arc.o
183186
agg23/src/agg_bspline.cpp
187+
agg23/src/agg_bspline.o
184188
agg23/src/agg_curves.cpp
189+
agg23/src/agg_curves.o
185190
agg23/src/agg_embedded_raster_fonts.cpp
191+
agg23/src/agg_embedded_raster_fonts.o
186192
agg23/src/agg_gsv_text.cpp
193+
agg23/src/agg_gsv_text.o
187194
agg23/src/agg_image_filters.cpp
195+
agg23/src/agg_image_filters.o
188196
agg23/src/agg_line_aa_basics.cpp
197+
agg23/src/agg_line_aa_basics.o
189198
agg23/src/agg_line_profile_aa.cpp
199+
agg23/src/agg_line_profile_aa.o
190200
agg23/src/agg_path_storage.cpp
201+
agg23/src/agg_path_storage.o
191202
agg23/src/agg_rasterizer_scanline_aa.cpp
203+
agg23/src/agg_rasterizer_scanline_aa.o
192204
agg23/src/agg_rounded_rect.cpp
205+
agg23/src/agg_rounded_rect.o
193206
agg23/src/agg_sqrt_tables.cpp
207+
agg23/src/agg_sqrt_tables.o
194208
agg23/src/agg_trans_affine.cpp
209+
agg23/src/agg_trans_affine.o
195210
agg23/src/agg_trans_double_path.cpp
211+
agg23/src/agg_trans_double_path.o
196212
agg23/src/agg_trans_single_path.cpp
213+
agg23/src/agg_trans_single_path.o
197214
agg23/src/agg_trans_warp_magnifier.cpp
215+
agg23/src/agg_trans_warp_magnifier.o
198216
agg23/src/agg_vcgen_bspline.cpp
217+
agg23/src/agg_vcgen_bspline.o
199218
agg23/src/agg_vcgen_contour.cpp
219+
agg23/src/agg_vcgen_contour.o
200220
agg23/src/agg_vcgen_dash.cpp
221+
agg23/src/agg_vcgen_dash.o
201222
agg23/src/agg_vcgen_markers_term.cpp
223+
agg23/src/agg_vcgen_markers_term.o
202224
agg23/src/agg_vcgen_smooth_poly1.cpp
225+
agg23/src/agg_vcgen_smooth_poly1.o
203226
agg23/src/agg_vcgen_stroke.cpp
227+
agg23/src/agg_vcgen_stroke.o
204228
agg23/src/agg_vpgen_clip_polygon.cpp
229+
agg23/src/agg_vpgen_clip_polygon.o
205230
agg23/src/agg_vpgen_clip_polyline.cpp
231+
agg23/src/agg_vpgen_clip_polyline.o
206232
agg23/src/agg_vpgen_segmentator.cpp
233+
agg23/src/agg_vpgen_segmentator.o
207234
agg23/src/authors
208235
agg23/src/autogen.sh
209236
agg23/src/configure.in
210237
agg23/src/copying
211238
agg23/src/install
239+
agg23/src/libagg.a
212240
agg23/src/news
213241
agg23/src/readme
214242
agg23/src/ctrl/Makefile.am
215243
agg23/src/ctrl/agg_bezier_ctrl.cpp
244+
agg23/src/ctrl/agg_bezier_ctrl.o
216245
agg23/src/ctrl/agg_cbox_ctrl.cpp
246+
agg23/src/ctrl/agg_cbox_ctrl.o
217247
agg23/src/ctrl/agg_gamma_ctrl.cpp
248+
agg23/src/ctrl/agg_gamma_ctrl.o
218249
agg23/src/ctrl/agg_gamma_spline.cpp
250+
agg23/src/ctrl/agg_gamma_spline.o
219251
agg23/src/ctrl/agg_polygon_ctrl.cpp
252+
agg23/src/ctrl/agg_polygon_ctrl.o
220253
agg23/src/ctrl/agg_rbox_ctrl.cpp
254+
agg23/src/ctrl/agg_rbox_ctrl.o
221255
agg23/src/ctrl/agg_scale_ctrl.cpp
256+
agg23/src/ctrl/agg_scale_ctrl.o
222257
agg23/src/ctrl/agg_slider_ctrl.cpp
258+
agg23/src/ctrl/agg_slider_ctrl.o
223259
agg23/src/ctrl/agg_spline_ctrl.cpp
260+
agg23/src/ctrl/agg_spline_ctrl.o
224261
agg23/src/platform/Makefile.am
225262
agg23/src/platform/AmigaOS/agg_platform_support.cpp
226263
agg23/src/platform/BeOS/agg_platform_support.cpp
227264
agg23/src/platform/X11/Makefile.am
228265
agg23/src/platform/X11/agg_platform_support.cpp
266+
agg23/src/platform/X11/agg_platform_support.o
229267
agg23/src/platform/mac/agg_mac_pmap.cpp
230268
agg23/src/platform/mac/agg_platform_support.cpp
231269
agg23/src/platform/sdl/agg_platform_support.cpp
@@ -279,6 +317,7 @@ examples/cursor_demo.py
279317
examples/custom_ticker1.py
280318
examples/customize_rc.py
281319
examples/dash_control.py
320+
examples/dashpointlabel.py
282321
examples/dashtick.py
283322
examples/data_helper.py
284323
examples/date_demo1.py
@@ -526,7 +565,6 @@ lib/dateutil/rrule.py
526565
lib/dateutil/tz.py
527566
lib/matplotlib/.cvsignore
528567
lib/matplotlib/__init__.py
529-
lib/matplotlib/__init__.py.~1.53.~
530568
lib/matplotlib/_contour.py
531569
lib/matplotlib/_image.py
532570
lib/matplotlib/_mathtext_data.py
@@ -535,18 +573,15 @@ lib/matplotlib/_transforms.py
535573
lib/matplotlib/afm.py
536574
lib/matplotlib/agg.py
537575
lib/matplotlib/artist.py
538-
lib/matplotlib/artist.py.~1.21.~
539576
lib/matplotlib/axes.py
540577
lib/matplotlib/axes.py.orig
541-
lib/matplotlib/axes.py.~1.104.~
542578
lib/matplotlib/axis.py
543-
lib/matplotlib/axis.py.~1.23.~
579+
lib/matplotlib/axis.py.orig
580+
lib/matplotlib/axis.py.rej
544581
lib/matplotlib/backend_bases.py
545582
lib/matplotlib/cbook.py
546583
lib/matplotlib/cm.py
547-
lib/matplotlib/cm.py.~1.16.~
548584
lib/matplotlib/collections.py
549-
lib/matplotlib/collections.py.~1.20.~
550585
lib/matplotlib/colors.py
551586
lib/matplotlib/contour.py
552587
lib/matplotlib/dates.py
@@ -560,19 +595,16 @@ lib/matplotlib/mathtext.py
560595
lib/matplotlib/mlab.py
561596
lib/matplotlib/patches.py
562597
lib/matplotlib/pylab.py
563-
lib/matplotlib/pylab.py.~1.63.~
564598
lib/matplotlib/pyparsing.py
565599
lib/matplotlib/table.py
566600
lib/matplotlib/texmanager.py
567601
lib/matplotlib/text.py
568602
lib/matplotlib/ticker.py
569-
lib/matplotlib/ticker.py.~1.25.~
570603
lib/matplotlib/transforms.py
571604
lib/matplotlib/windowing.py
572605
lib/matplotlib/backends/.cvsignore
573606
lib/matplotlib/backends/__init__.py
574607
lib/matplotlib/backends/backend_agg.py
575-
lib/matplotlib/backends/backend_agg.py.~1.25.~
576608
lib/matplotlib/backends/backend_agg2.py
577609
lib/matplotlib/backends/backend_cairo.py
578610
lib/matplotlib/backends/backend_fltkagg.py
@@ -641,7 +673,6 @@ lib/matplotlib/enthought/util/__init__.py
641673
lib/matplotlib/enthought/util/resource.py
642674
lib/matplotlib/numerix/.cvsignore
643675
lib/matplotlib/numerix/__init__.py
644-
lib/matplotlib/numerix/__init__.py.~1.2.~
645676
lib/matplotlib/numerix/_na_imports.py
646677
lib/matplotlib/numerix/_nc_imports.py
647678
lib/matplotlib/numerix/fft/__init__.py
@@ -1265,6 +1296,7 @@ swig/agg_path_storage.i
12651296
swig/agg_rasterizer_scanline_aa.i
12661297
swig/agg_renderer_base.i
12671298
swig/agg_renderer_scanline.i
1299+
swig/agg_scanline_bin.i
12681300
swig/agg_trans_affine.i
12691301
swig/agg_typedefs.h
12701302
swig/agg_typemaps.i

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Makefile for matplotlib
22

3-
PYTHON = /usr/local/bin/python2.3
3+
PYTHON = /usr/bin/python2.4
44
VERSION = `${PYTHON} setup.py --version`
55

66
DISTFILES = API_CHANGES KNOWN_BUGS INSTALL README TODO license \

examples/backend_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def drive(backend, python='python2.4'):
116116
# backends = ['Agg', 'Cairo', 'GDK', 'PS', 'SVG', 'Template']
117117
backends = ['Agg', 'PS', 'SVG', 'Template']
118118
# backends = [ 'GTK', 'WX', 'TkAgg']
119-
# backends = ['PS']
119+
backends = ['Agg', 'PS']
120120
python = 'python2.4'
121121
for backend in backends:
122122
print 'testing %s' % backend

examples/tex_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
fontsize=16, color='r')
3030
grid(True)
3131
savefig('tex_demo.eps')
32-
savefig('jdh.ps')
32+
3333

3434
show()

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
"""
143143
from __future__ import generators
144144

145-
__version__ = '0.81'
145+
__version__ = '0.81.1'
146146
__revision__ = '$Revision$'
147147
__date__ = '$Date$'
148148

lib/matplotlib/mlab.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,11 @@ def hist(y, bins=10, normed=0):
617617
if ymin==ymax:
618618
ymin -= 0.5
619619
ymax += 0.5
620-
bins = linspace(ymin, ymax, bins)
620+
621+
if bins==1: bins=ymax
622+
dy = (ymax-ymin)/bins
623+
bins = ymin + dy*arange(bins)
624+
621625

622626
n = searchsorted(sort(y), bins)
623627
n = diff(concatenate([n, [len(y)]]))

lib/matplotlib/numerix/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,14 @@ def _import_fail_message(module, version):
8787
%(which)s and then re-install matplotlib. Otherwise, the following
8888
traceback gives more details:\n""" % _dict
8989

90+
91+
g = globals()
92+
l = locals()
93+
__import__('ma', g, l)
94+
__import__('fft', g, l)
95+
__import__('linear_algebra', g, l)
96+
__import__('random_array', g, l)
97+
__import__('mlab', g, l)
98+
99+
la = linear_algebra
100+
ra = random_array

lib/matplotlib/pylab.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@
216216
from patches import Polygon, Rectangle, Circle, Arrow
217217
from transforms import blend_xy_sep_transform
218218

219+
import numerix as nx
220+
219221
# catch more than an import error here, since the src could fail too,
220222
# eg a bad pytz install. I don't want to break all of matplotlib for
221223
# date support

lib/matplotlib/ticker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,8 @@ def get_locator(self, d):
857857

858858
try: ld = math.log10(d)
859859
except OverflowError:
860-
warnings.warn('AutoLocator illegal dataInterval range %s; returning NullLocator'%d)
861-
return NullLocator()
860+
raise RuntimeError('AutoLocator illegal dataInterval range')
861+
862862

863863
fld = math.floor(ld)
864864
base = 10**fld

setupext.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
'win32' : ['win32_static',],
3838
'linux2' : ['/usr/local', '/usr',],
3939
'linux' : ['/usr/local', '/usr',],
40-
'darwin' : ['/sw/lib/freetype219', '/usr/local', '/usr', '/sw', '/usr/X11R6'],
40+
# Charles Moad recommends not putting in /usr/X11R6 for darwin
41+
# because freetype in this dir is too old for mpl
42+
'darwin' : ['/sw/lib/freetype219', '/usr/local', '/usr', '/sw'],
4143
'freebsd4' : ['/usr/local', '/usr'],
4244
'freebsd5' : ['/usr/local', '/usr'],
4345
'freebsd6' : ['/usr/local', '/usr'],

0 commit comments

Comments
 (0)