Is there a way in Bokeh to automatically set a new color for each line in a plot? Something like 'hold all' in matlab.
from bokeh.plotting import figure
x= [1,2,3,4,5]
y = [1,2,3,4,5]
p = figure()
p.multi_line([x,x],[np.power(y,2),np.power(y,3)])
show(p)
# I'd like all lines to automatically be a different color, or selected from a map
p = figure()
p.line(x,np.power(y,2))
p.line(x,np.power(y,3))
# And/or this to produce lines of different color
It can be done by selecting the colors from palette and setting different for each line plot:
from bokeh.palettes import Dark2_5 as palette
import itertools
#colors has a list of colors which can be used in plots
colors = itertools.cycle(palette)
p = figure()
p.line(x,np.power(y,2),color=colors[0])
p.line(x,np.power(y,3),color=colors[1])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With