Skip to content

Commit abf0191

Browse files
committed
process dim objects as actual dimensions
1 parent ddf6c6d commit abf0191

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

hvplot/converter.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,11 @@ def _process_style(self, kwds, plot_opts):
17891789
color = kwds.pop('color', kwds.pop('c', None))
17901790

17911791
if color is not None:
1792-
if (self.datashade or self.rasterize) and color in [self.x, self.y]:
1792+
if (
1793+
(self.datashade or self.rasterize)
1794+
and isinstance(color, str)
1795+
and color in [self.x, self.y]
1796+
):
17931797
self.data = self.data.assign(_color=self.data[color])
17941798
style_opts['color'] = color = '_color'
17951799
self.variables.append('_color')
@@ -1800,12 +1804,12 @@ def _process_style(self, kwds, plot_opts):
18001804
else:
18011805
style_opts['color'] = color
18021806

1803-
if (
1804-
not isinstance(color, list)
1805-
and color in self.variables
1806-
and 'c' in self._kind_options.get(kind, [])
1807-
):
1808-
if self.data[color].dtype.kind in 'OSU':
1807+
color_dim = self._validate_dim(color)
1808+
if color_dim is None and isinstance(color, str) and color in self.variables:
1809+
color_dim = color
1810+
1811+
if color_dim is not None and 'c' in self._kind_options.get(kind, []):
1812+
if self.data[color_dim].dtype.kind in 'OSU':
18091813
cmap = cmap or self._default_cmaps['categorical']
18101814
else:
18111815
plot_opts['colorbar'] = plot_opts.get('colorbar', True)
@@ -1832,9 +1836,10 @@ def _process_style(self, kwds, plot_opts):
18321836
else:
18331837
color = style_opts.get('color')
18341838

1839+
color_is_dim = isinstance(color, dim)
18351840
for k, v in style.items():
18361841
if isinstance(v, Cycle) and isinstance(v, str):
1837-
if color == cmap:
1842+
if not color_is_dim and color == cmap:
18381843
if color not in Palette.colormaps and color.title() in Palette.colormaps:
18391844
color = color.title()
18401845
else:

0 commit comments

Comments
 (0)