10000 Merge pull request #1061 from bgamari/master · matplotlib/matplotlib@f3ccff3 · GitHub
[go: up one dir, main page]

Skip to content

Commit f3ccff3

Browse files
committed
Merge pull request #1061 from bgamari/master
Add log option to Axes.hist2d
2 parents dd9cfa4 + d33877c commit f3ccff3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from matplotlib.colors import LogNorm
2+
from pylab import *
3+
4+
#normal distribution center at x=0 and y=5
5+
x = randn(100000)
6+
y = randn(100000)+5
7+
8+
hist2d(x, y, bins=40, norm=LogNorm())
9+
colorbar()
10+
show()

lib/matplotlib/axes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8223,7 +8223,11 @@ def hist2d(self, x, y, bins = 10, range=None, normed=False, weights=None,
82238223
these count values in the return value count histogram
82248224
will also be set to nan upon return
82258225
8226-
Remaining keyword arguments are passed directly to :meth:pcolorfast
8226+
Remaining keyword arguments are passed directly to :meth:`pcolorfast`.
8227+
8228+
Rendering the histogram with a logarithmic color scale is
8229+
accomplished by passing a :class:`colors.LogNorm` instance to
8230+
the *norm* keyword argument.
82278231
82288232
**Example:**
82298233

0 commit comments

Comments
 (0)
0