How to color a datahader /holoview plot according to the diffrent custom category with color bar enabled

127 Views Asked by At

I have the following dataset

df.head(10)

lat      long   temperature(f) category 
11.15   34.58   47.55   green
16.30   48.45   41.41   blue
17.53   48.70   32.787  blue
19.74   58.77   34.60   blue
18.97   68.70   70.73   yellow
29.22   68.32   34.21   blue
45.26   78.70   17.74   indigo
34.41   68.58   90.12   red
16.44   98.19   23.36   indigo
69.56   49.77   61.72   yellow

I have 5 Million records and I categorized it depending on the temparature value. Note I need to visualize the data in a datashader plot with color maps being mapped to categories.

1

There are 1 best solutions below

1
James A. Bednar On

Datashader is able to colorize categorical plots by mixing colors per pixel, but current releases of Bokeh do not have that capability. For now, you can use the technique from https://examples.pyviz.org/ship_traffic , which allow you to fake a legend manually. Bokeh 3.1 is due for release any day now, though, and it includes categorical colormapping (https://github.com/bokeh/bokeh/pull/12356). So there should soon be a good answer to this question, once the HoloViz tools like Panel and HoloViews have been released in Bokeh 3-compatible versions.