Skip to content

Commit

Permalink
Relax restriction on element type for discrete histplot (#2859)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaskom committed Jun 15, 2022
1 parent 9d8ce6a commit a48dc8f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 2 additions & 0 deletions doc/releases/v0.12.0.txt
Expand Up @@ -57,6 +57,8 @@ Other updates

- |Enhancement| |Fix| Improved integration with the matplotlib color cycle in most axes-level functions (:pr:`2449`).

- |Enhancement| It is now possible to plot a discrete :func:`histplot` as a step function or polygon (:pr:`2859`).

- |Fix| Fixed a regression in 0.11.2 that caused some functions to stall indefinitely or raise when the input data had a duplicate index (:pr:`2776`).

- |Fix| Fixed a bug in :func:`histplot` and :func:`kdeplot` where weights were not factored into the normalization (:pr:`2812`).
Expand Down
3 changes: 0 additions & 3 deletions seaborn/distributions.py
Expand Up @@ -398,9 +398,6 @@ def plot_univariate_histogram(
_check_argument("multiple", ["layer", "stack", "fill", "dodge"], multiple)
_check_argument("element", ["bars", "step", "poly"], element)

if estimate_kws["discrete"] and element != "bars":
raise ValueError("`element` must be 'bars' when `discrete` is True")

auto_bins_with_weights = (
"weights" in self.variables
and estimate_kws["bins"] == "auto"
Expand Down
5 changes: 0 additions & 5 deletions tests/test_distributions.py
Expand Up @@ -1449,11 +1449,6 @@ def test_categorical_yaxis_inversion(self, long_df):
ymax, ymin = ax.get_ylim()
assert ymax > ymin

def test_discrete_requires_bars(self, long_df):

with pytest.raises(ValueError, match="`element` must be 'bars'"):
histplot(long_df, x="s", discrete=True, element="poly")

@pytest.mark.skipif(
Version(np.__version__) < Version("1.17"),
reason="Histogram over datetime64 requires numpy >= 1.17",
Expand Down

0 comments on commit a48dc8f

Please sign in to comment.