can we specify color of points in bokeh using some column of the dataframe as in ggplot?

441 views Asked by At

In ggplot we can do ggplot(data,aes(x='col1',y='col2',color='col3')) this will give points color based on the values of col3 even if the values in col3 aren't explicit color names (like red,green,etc) How can we do something like this with bokeh

1

There are 1 answers

0
Infi On

Bokeh palettes store colors in lists. The plot function needs a explicit value. For example -

from bokeh.plotting import figure, show
from bokeh.palettes import Greys
p=figure()
color=Greys[3][1] #See the pyramid in the above mentioned link
p.line([1,2,3],[2,3,2],color=color)
show(p)