diff --git a/hvplot/converter.py b/hvplot/converter.py index e564610b3..be5532c86 100644 --- a/hvplot/converter.py +++ b/hvplot/converter.py @@ -885,10 +885,8 @@ def _process_data(self, kind, data, x, y, by, groupby, row, col, 'e.g. a NumPy array or xarray Dataset, ' f'found {type(self.data).__name__} type') - if hasattr(data, 'columns') and hasattr(data.columns, 'name') and data.columns.name and not group_label: + if hasattr(data, 'columns') and hasattr(data.columns, 'name') and data.columns.name and group_label is None: group_label = data.columns.name - elif not group_label: - group_label = 'Variable' if isinstance(data.columns, pd.MultiIndex) and x in (None, 'index') and y is None and not by: self.data = data.stack().reset_index(1).rename(columns={'level_1': group_label}) @@ -944,7 +942,7 @@ def _process_data(self, kind, data, x, y, by, groupby, row, col, self.gridded_data = gridded_data self.use_dask = use_dask self.indexes = indexes - self.group_label = group_label or 'Variable' + self.group_label = group_label if isinstance(by, (np.ndarray, pd.Series)): self.data = self.data.assign(_by=by) self.by = ['_by']