@@ -215,8 +215,8 @@ def get_agg_data(cls, obj, category=None):
215215
216216 for d in (x , y ):
217217 if df [d ].dtype .kind == 'M' :
218- param .warning ('Casting %s dimension data to integer '
219- 'datashader cannot process datetime data ' )
218+ param .main . warning ('Casting %s dimension data to integer; '
219+ 'datashader cannot process datetime data' , d )
220220 df [d ] = df [d ].astype ('int64' ) / 1000000.
221221
222222 return x , y , Dataset (df , kdims = kdims , vdims = vdims ), glyph
@@ -356,7 +356,13 @@ class shade(Operation):
356356 """
357357
358358 cmap = param .ClassSelector (default = fire , class_ = (Iterable , Callable , dict ), doc = """
359- Iterable or callable which returns colors as hex colors.
359+ Iterable or callable which returns colors as hex colors, to
360+ be used for the colormap of single-layer datashader output.
361+ Callable type must allow mapping colors between 0 and 1.""" )
362+
363+ color_key = param .ClassSelector (class_ = (Iterable , Callable , dict ), doc = """
364+ Iterable or callable which returns colors as hex colors, to
365+ be used for the color key of categorical datashader output.
360366 Callable type must allow mapping colors between 0 and 1.""" )
361367
362368 normalization = param .ClassSelector (default = 'eq_hist' ,
@@ -430,15 +436,15 @@ def _process(self, element, key=None):
430436 if element .ndims > 2 :
431437 kdims = element .kdims [1 :]
432438 categories = array .shape [- 1 ]
433- if not self .p .cmap :
439+ if not self .p .color_key :
434440 pass
435- elif isinstance (self .p .cmap , dict ):
436- shade_opts ['color_key' ] = self .p .cmap
437- elif isinstance (self .p .cmap , Iterable ):
441+ elif isinstance (self .p .color_key , dict ):
442+ shade_opts ['color_key' ] = self .p .color_key
443+ elif isinstance (self .p .color_key , Iterable ):
438444 shade_opts ['color_key' ] = [c for i , c in
439- zip (range (categories ), self .p .cmap )]
445+ zip (range (categories ), self .p .color_key )]
440446 else :
441- colors = [self .p .cmap (s ) for s in np .linspace (0 , 1 , categories )]
447+ colors = [self .p .color_key (s ) for s in np .linspace (0 , 1 , categories )]
442448 shade_opts ['color_key' ] = map (self .rgb2hex , colors )
443449 elif not self .p .cmap :
444450 pass
0 commit comments