You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi folks,
first thing first -really enjoying getting to grips with holoviews - feels like a breath of fresh air after years of matplotlib, so thanks.
Not sure if this is a proper bug or a documentation issue, but in the styling plots examples explicit color-mapping is mentioned and an example given. However, this only works if the entries in the 'color_index' column (and equivalently, keys in the explicit mapping dictionary) are of string type so e.g. the following code:
~/code/external/holoviews/holoviews/plotting/util.py in process_cmap(cmap, ncolors, provider, categorical)
849 if not isinstance(palette, list):
850 raise TypeError("cmap argument %s expects a list, Cycle or valid %s colormap or palette."
--> 851 % (cmap,providers_checked))
852 if ncolors and len(palette) != ncolors:
853 return [palette[i%len(palette)] for i in range(ncolors)]
TypeError: cmap argument {0: 'blue', 1: 'red', 2: 'green', 3: 'purple'} expects a list, Cycle or valid matplotlib, bokeh, or colorcet colormap or palette
The use-case for this is that I want to set the 'color_index' to a boolean column then pick specific colors. I want to do so because If, e.g I pick 'tab10' then True/False get mapped to the extreme ends of the categorical colormap and then actually get plotted as quite similar colors - perhaps that's worth filing as a separate issue? I guess the larger issue here is that then normalization needs to handled differently for categorical vs continuous colormaps, so I can see that being a pain.
The text was updated successfully, but these errors were encountered:
I'll consider this a bug, basically for integers it currently assumes the data is continuous which means an explicit mapping doesn't make sense but supplying an explicit mapping in itself should be sufficient to declare the color mapping as categorical.
So, after a moment's extra thought, I've come up with a basic workaround for my case in the interim: cmap=bokeh.palettes.Set1[3]
But that does require a little familiarity with Bokeh ;)
Hi folks,
first thing first -really enjoying getting to grips with holoviews - feels like a breath of fresh air after years of matplotlib, so thanks.
Not sure if this is a proper bug or a documentation issue, but in the styling plots examples explicit color-mapping is mentioned and an example given. However, this only works if the entries in the 'color_index' column (and equivalently, keys in the explicit mapping dictionary) are of string type so e.g. the following code:
Gives
The use-case for this is that I want to set the 'color_index' to a boolean column then pick specific colors. I want to do so because If, e.g I pick 'tab10' then True/False get mapped to the extreme ends of the categorical colormap and then actually get plotted as quite similar colors - perhaps that's worth filing as a separate issue? I guess the larger issue here is that then normalization needs to handled differently for categorical vs continuous colormaps, so I can see that being a pain.
The text was updated successfully, but these errors were encountered: