Skip to content

Commit e5c48d6

Browse files
committed
Change hist empty check to not use 2D arrays.
This causes a NumPy deprecation warning if the list is ragged.
1 parent e842b17 commit e5c48d6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6558,8 +6558,6 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
65586558
# Massage 'x' for processing.
65596559
x = cbook._reshape_2D(x, 'x')
65606560
nx = len(x) # number of datasets
6561-
# basic input validation
6562-
input_empty = np.size(x) == 0
65636561

65646562
# Process unit information
65656563
# Unit conversion is done individually on each dataset
@@ -6581,9 +6579,13 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
65816579
if len(w) != nx:
65826580
raise ValueError('weights should have the same shape as x')
65836581

6582+
input_empty = True
65846583
for xi, wi in zip(x, w):
6585-
if wi is not None and len(wi) != len(xi):
6584+
lxi = len(xi)
6585+
if wi is not None and len(wi) != lxi:
65866586
raise ValueError('weights should have the same shape as x')
6587+
if lxi:
6588+
input_empty = False
65876589

65886590
if color is None:
65896591
color = [self._get_lines.get_next_color() for i in range(nx)]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy