-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Milestone
Description
I tried to heed the deprecation warning and replace a call with distplot where I had set hist_kws["log"] = True
, but every attempt I've made to use log_scale=True in histplot with v0.11.1 fails. A minimal example is:
ValueError Traceback (most recent call last)
<ipython-input-4-6dc875eca8b6> in <module>
----> 1 seaborn.histplot(list(range(20)), log_scale=True)
~/.local/lib/python3.7/site-packages/seaborn/distributions.py in histplot(data, x, y, hue, weights, stat, bins, binwidth, binrange, discrete, cumulative, common_bins, common_norm, multiple, element, fill, shrink, kde, kde_kws, line_kws, thresh, pthresh, pmax, cbar, cbar_ax, cbar_kws, palette, hue_order, hue_norm, color, log_scale, legend, ax, **kwargs)
1434 estimate_kws=estimate_kws,
1435 line_kws=line_kws,
-> 1436 **kwargs,
1437 )
1438
~/.local/lib/python3.7/site-packages/seaborn/distributions.py in plot_univariate_histogram(self, multiple, element, fill, common_norm, common_bins, shrink, kde, kde_kws, color, legend, line_kws, estimate_kws, **plot_kws)
435
436 # Do the histogram computation
--> 437 heights, edges = estimator(observations, weights=weights)
438
439 # Rescale the smoothed curve to match the histogram
~/.local/lib/python3.7/site-packages/seaborn/_statistics.py in __call__(self, x1, x2, weights)
369 """Count the occurrances in each bin, maybe normalize."""
370 if x2 is None:
--> 371 return self._eval_univariate(x1, weights)
372 else:
373 return self._eval_bivariate(x1, x2, weights)
~/.local/lib/python3.7/site-packages/seaborn/_statistics.py in _eval_univariate(self, x, weights)
346 bin_edges = self.bin_edges
347 if bin_edges is None:
--> 348 bin_edges = self.define_bin_edges(x, weights=weights, cache=False)
349
350 density = self.stat == "density"
~/.local/lib/python3.7/site-packages/seaborn/_statistics.py in define_bin_edges(self, x1, x2, weights, cache)
264
265 bin_edges = self._define_bin_edges(
--> 266 x1, weights, self.bins, self.binwidth, self.binrange, self.discrete,
267 )
268
~/.local/lib/python3.7/site-packages/seaborn/_statistics.py in _define_bin_edges(self, x, weights, bins, binwidth, binrange, discrete)
255 else:
256 bin_edges = np.histogram_bin_edges(
--> 257 x, bins, binrange, weights,
258 )
259 return bin_edges
<__array_function__ internals> in histogram_bin_edges(*args, **kwargs)
~/.local/lib/python3.7/site-packages/numpy/lib/histograms.py in histogram_bin_edges(a, bins, range, weights)
666 """
667 a, weights = _ravel_and_check_weights(a, weights)
--> 668 bin_edges, _ = _get_bin_edges(a, bins, range, weights)
669 return bin_edges
670
~/.local/lib/python3.7/site-packages/numpy/lib/histograms.py in _get_bin_edges(a, bins, range, weights)
394 "bins is not supported for weighted data")
395
--> 396 first_edge, last_edge = _get_outer_edges(a, range)
397
398 # truncate the range if needed
~/.local/lib/python3.7/site-packages/numpy/lib/histograms.py in _get_outer_edges(a, range)
322 if not (np.isfinite(first_edge) and np.isfinite(last_edge)):
323 raise ValueError(
--> 324 "autodetected range of [{}, {}] is not finite".format(first_edge, last_edge))
325
326 # expand empty range to avoid divide by zero
ValueError: autodetected range of [-inf, 1.2787536009528289] is not finite
Worse still, the error persists if repeating the call with log_scale=False.