Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting group_label when plotting a hist #1310

Merged
merged 1 commit into from
Apr 16, 2024
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
2 changes: 1 addition & 1 deletion hvplot/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,7 @@ def hist(self, x=None, y=None, data=None):
for col in y:
hist = histogram(ds, dimension=col, **hist_opts)
hists.append((col, hist.relabel(**self._relabel)))
return (self._by_type(hists, sort=False)
return (self._by_type(hists, self.group_label, sort=False)
.redim(**self._redim)
.opts(cur_opts, backend='bokeh')
.opts(compat_opts, backend=self._backend_compat))
Expand Down
4 changes: 4 additions & 0 deletions hvplot/tests/testcharts.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ def test_histogram_by_category_legend_position(self):
opts = Store.lookup_options('bokeh', plot, 'plot')
self.assertEqual(opts.kwargs['legend_position'], 'left')

def test_histogram_wide_set_group_label(self):
plot = self.df.hvplot.hist(group_label='Test')
assert plot.kdims[0].name == 'Test'

def test_scatter_color_internally_set_to_dim(self):
altered_df = self.cat_df.copy().rename(columns={'category': 'red'})
plot = altered_df.hvplot.scatter('x', 'y', c='red')
Expand Down
Loading