🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4943,7 +4943,9 @@ def reduce_C_function(C: array) -> float
# autoscale the norm with current accum values if it hasn't been set
if norm is not None:
if norm.vmin is None and norm.vmax is None:
norm.autoscale(accum)
norm.autoscale_None(accum)
norm.vmin = np.ma.masked if norm.vmin is None else norm.vmin
norm.vmax = np.ma.masked if norm.vmax is None else norm.vmax

if bins is not None:
if not np.iterable(bins):
Expand Down
8 changes: 8 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,14 @@ def test_hexbin_empty():
ax.hexbin([], [])


@image_comparison(['hexbin_empty.png'], remove_text=True)
def test_hexbin_log_empty():
# From #23922: creating hexbin with log scaling from empty
# dataset raises ValueError
ax = plt.gca()
ax.hexbin([], [], bins='log')


def test_hexbin_pickable():
# From #1973: Test that picking a hexbin collection works
fig, ax = plt.subplots()
Expand Down