使用散景打印时,如何自动在调色板上循环显示? [英] When plotting with Bokeh, how do you automatically cycle through a color pallette?
问题描述
我想使用循环来加载和/或修改数据并使用Bokeh在循环内绘制结果(我熟悉
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)
生成此图
如何使颜色循环而不用编码颜色列表以及当颜色数量用完时重复进行模运算?
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?
与此相关的GitHub上有一些讨论,问题 351 和 2201 ,但目前尚不清楚如何实现此目的.在文档中搜索cycle color
实际上在页面上的任何地方都没有包含单词cycle
.
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.
推荐答案
这篇关于使用散景打印时,如何自动在调色板上循环显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!