8000 Merge pull request #20729 from svank/hexbin-log-vminvmax · matplotlib/matplotlib@64e898a · GitHub
[go: up one dir, main page]

Skip to content

Commit 64e898a

Browse files
authored
Merge pull request #20729 from svank/hexbin-log-vminvmax
Support vmin/vmax with bins='log' in hexbin
2 parents ad66238 + d050f58 commit 64e898a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4799,7 +4799,8 @@ def reduce_C_function(C: array) -> float
47994799
_api.warn_external("Only one of 'bins' and 'norm' arguments "
48004800
f"can be supplied, ignoring bins={bins}")
48014801
else:
4802-
norm = mcolors.LogNorm()
4802+
norm = mcolors.LogNorm(vmin=vmin, vmax=vmax)
4803+
vmin = vmax = None
48034804
bins = None
48044805

48054806
if isinstance(norm, mcolors.LogNorm):

lib/matplotlib/tests/test_axes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,13 @@ def test_hexbin_log():
785785
plt.colorbar(h)
786786

787787

788+
def test_hexbin_log_clim():
789+
x, y = np.arange(200).reshape((2, 100))
790+
fig, ax = plt.subplots()
791+
h = ax.hexbin(x, y, bins='log', vmin=2, vmax=100)
792+
assert h.get_clim() == (2, 100)
793+
794+
788795
def test_inverted_limits():
789796
# Test gh:1553
790797
# Calling invert_xaxis prior to plotting should not disable autoscaling

0 commit comments

Comments
 (0)
0