Skip to content

Commit

Permalink
Fix rugplot with datetime data (#2458)
Browse files Browse the repository at this point in the history
Fixes #2451
  • Loading branch information
mwaskom authored Jan 31, 2021
1 parent 63e28ce commit 136b462
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/releases/v0.12.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ v0.12.0 (Unreleased)

- |Fix| In :func:`lineplot, allowed the `dashes` keyword to set the style of a line without mapping a `style` variable (:pr:`2449`).

- |Fix| In :func:`rugplot`, fixed a bug that prevented the use of datetime data (:pr:`2458`).

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

- Made `scipy` an optional dependency and added `pip install seaborn[all]` as a method for ensuring the availability of compatible `scipy` and `statsmodels` libraries at install time. This has a few minor implications for existing code, which are explained in the Github pull request (:pr:`2398`).
Expand Down
2 changes: 1 addition & 1 deletion seaborn/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ def plot_univariate_ecdf(self, estimate_kws, legend, **plot_kws):

def plot_rug(self, height, expand_margins, legend, **kws):

for sub_vars, sub_data, in self.iter_data():
for sub_vars, sub_data, in self.iter_data(from_comp_data=True):

ax = self._get_axes(sub_vars)

Expand Down
6 changes: 6 additions & 0 deletions seaborn/tests/test_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ def test_flat_vector(self, long_df):
rugplot(x=long_df["x"])
self.assert_rug_equal(*ax.collections)

def test_datetime_data(self, long_df):

ax = rugplot(data=long_df["t"])
vals = np.stack(ax.collections[0].get_segments())[:, 0, 0]
assert_array_equal(vals, mpl.dates.date2num(long_df["t"]))

def test_empty_data(self):

ax = rugplot(x=[])
Expand Down

0 comments on commit 136b462

Please sign in to comment.