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() 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:**