I want to use a loop to load and/or modify data and plot the result within the loop using Bokeh (I am familiar with Matplotlib's axes.color_cycle
). Here is a simple example
import numpy as np
from bokeh.plotting import figure, output_file, show
output_file('bokeh_cycle_colors.html')
p = figure(width=400, height=400)
x = np.linspace(0, 10)
for m in xrange(10):
y = m * x
p.line(x, y, legend='m = {}'.format(m))
p.legend.location='top_left'
show(p)
which generates this plot
How do I make it so the colors cycle without coding up a list of colors and a modulus operation to repeat when the number of colors runs out?
There was some discussion on GitHub related to this, issues 351 and 2201, but it is not clear how to make this work. The four hits I got when searching the documentation for cycle color
did not actually contain the word cycle
anywhere on the page.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…