Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.relabel(**self._relabel).opts(**opts))
labelled = ['y' if self.invert else 'x'] if self.group_label != 'Group' else []
if self.value_label != 'value':
labelled.append('x' if self.invert else 'y')
if 'xlabel' in self._plot_opts and 'x' not in labelled:
labelled.append('x')
if 'ylabel' in self._plot_opts and 'y' not in labelled:
labelled.append('y')
opts['plot']['labelled'] = labelled
kdims = [self.group_label]
data = data[list(y)]
if check_library(data, 'dask'):
from dask.dataframe import melt
else:
melt = pd.melt
df = melt(data, var_name=self.group_label, value_name=self.value_label)
redim = self._merge_redim({self.value_label: ylim})
return (element(df, kdims, self.value_label).redim(**redim)
.relabel(**self._relabel).opts(**opts))
if 'xlabel' in self._plot_opts and 'x' not in labelled:
labelled.append('x')
if 'ylabel' in self._plot_opts and 'y' not in labelled:
labelled.append('y')
opts = {'plot': dict(self._plot_opts, labelled=labelled),
'style': dict(self._style_opts),
'norm': self._norm_opts}
id_vars = [x]
if any(v in self.indexes for v in id_vars):
data = data.reset_index()
data = data[y+[x]]
if check_library(data, 'dask'):
from dask.dataframe import melt
else:
melt = pd.melt
df = melt(data, id_vars=[x], var_name=self.group_label, value_name=self.value_label)
kdims = [x, self.group_label]
vdims = [self.value_label]+self.hover_cols
if self.subplots:
obj = Dataset(df, kdims, vdims).to(element, x).layout()
else:
obj = element(df, kdims, vdims)
return (obj.redim(**self._redim)
.relabel(**self._relabel).opts(**opts))