From 4e82fa88aed8088aef1a621010fe7482c10f70f8 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Wed, 22 Aug 2012 08:56:11 -0400 Subject: [PATCH 1/2] Add note regarding use of LogNorm with hist2d --- lib/matplotlib/axes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index 01e772c44647..ae35b69998a9 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -8077,7 +8077,11 @@ def hist2d(self, x, y, bins = 10, range=None, normed=False, weights=None, All bins that has count more than cmax will not be displayed (set to none before passing to imshow) and these count values in the return value count histogram will also be set to nan upon return - Remaining keyword arguments are passed directly to :meth:pcolorfast + Remaining keyword arguments are passed directly to :meth:`pcolorfast`. + + Rendering the histogram with a logarithmic color scale is + accomplished by passing a :class:`colors.LogNorm` instance to + the *norm* keyword argument. **Example:** From d33877c9da5f05da467b99cc12c20b85bf255f6a Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Tue, 28 Aug 2012 11:03:50 -0400 Subject: [PATCH 2/2] Add example for logarithmic hist2d --- examples/pylab_examples/hist2d_log_demo.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 examples/pylab_examples/hist2d_log_demo.py diff --git a/examples/pylab_examples/hist2d_log_demo.py b/examples/pylab_examples/hist2d_log_demo.py new file mode 100644 index 000000000000..b1cd09de0554 --- /dev/null +++ b/examples/pylab_examples/hist2d_log_demo.py @@ -0,0 +1,10 @@ +from matplotlib.colors import LogNorm +from pylab import * + +#normal distribution center at x=0 and y=5 +x = randn(100000) +y = randn(100000)+5 + +hist2d(x, y, bins=40, norm=LogNorm()) +colorbar() +show()