Skip to content

Instantly share code, notes, and snippets.

@duncanmmacleod
Created April 1, 2014 00:03
Show Gist options
  • Save duncanmmacleod/9905055 to your computer and use it in GitHub Desktop.
Save duncanmmacleod/9905055 to your computer and use it in GitHub Desktop.
From 68260d51a027baa64e88e1f5966dd449883c1cca Mon Sep 17 00:00:00 2001
From: Duncan Macleod <duncanmmacleod@gmail.com>
Date: Mon, 31 Mar 2014 18:48:24 -0500
Subject: [PATCH] Axes.hist: fix bug in weighted log-step hist
- need to weight the minimum by the data for weighted histograms
---
lib/matplotlib/axes/_axes.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py
index 6b8ad45..06f69b0 100644
--- a/lib/matplotlib/axes/_axes.py
+++ b/lib/matplotlib/axes/_axes.py
@@ -5635,7 +5635,7 @@ class Axes(_AxesBase):
logbase = self.yaxis._scale.base
# Setting a minimum of 0 results in problems for log plots
- if normed:
+ if normed or weights is not None:
# For normed data, set to log base * minimum data value
# (gives 1 full tick-label unit for the lowest filled bin)
ndata = np.array(n)
--
1.8.5.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment