Revision: 6459
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6459&view=rev
Author: mmetz_bn
Date: 2008-12-01 10:10:39 +0000 (Mon, 01 Dec 2008)
Log Message:
-----------
Fixed histogram autoscaling bug when bins or range are given explicitly
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-11-30 18:33:55 UTC (rev 6458)
+++ trunk/matplotlib/CHANGELOG 2008-12-01 10:10:39 UTC (rev 6459)
@@ -1,3 +1,6 @@
+2008-12-01 Fixed histogram autoscaling bug when bins or range are given
+ explicitly (fixes Debian bug 503148) - MM
+
2008-11-25 Added rcParam axes.unicode_minus which allows plain hypen
for minus when False - JDH
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-11-30 18:33:55 UTC (rev
6458)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-01 10:10:39 UTC (rev
6459)
@@ -6510,6 +6510,9 @@
"""
if not self._hold: self.cla()
+ # NOTE: the range keyword overwrites the built-in func range !!!
+ # needs to be fixed in with numpy !!!
+
if kwargs.get('width') is not None:
raise DeprecationWarning(
'hist now uses the rwidth to give relative width '
@@ -6531,6 +6534,10 @@
tx.append( np.array(x[i]) )
x = tx
+ # Check whether bins or range are given explicitly. In that
+ # case do not autoscale axes.
+ binsgiven = (cbook.iterable(bins) or range != None)
+
n = []
for i in xrange(len(x)):
# this will automatically overwrite bins,
@@ -6541,9 +6548,8 @@
if cumulative:
slc = slice(None)
- if cbook.is_numlike(cumulative):
- if cumulative < 0:
- slc = slice(None,None,-1)
+ if cbook.is_numlike(cumulative) and cumulative < 0:
+ slc = slice(None,None,-1)
if normed:
n = [(m * np.diff(bins))[slc].cumsum()[slc] for m in n]
@@ -6675,6 +6681,16 @@
p.set_label(label)
label = '_nolegend_'
+ if binsgiven:
+ self.set_autoscale_on(False)
+ if orientation == 'vertical':
+ self.autoscale_view(scalex=False, scaley=True)
+ XL = self.xaxis.get_major_locator().view_limits(bins[0],
bins[-1])
+ self.set_xbound(XL)
+ else:
+ self.autoscale_view(scalex=True, scaley=False)
+ YL = self.yaxis.get_major_locator().view_limits(bins[0],
bins[-1])
+ self.set_ybound(YL)
if len(n)==1:
return n[0], bins, cbook.silent_list('Patch', patches[0])
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins