使用散景打印时,如何自动在调色板上循环显示? [英] When plotting with Bokeh, how do you automatically cycle through a color pallette?

查看:78
本文介绍了使用散景打印时,如何自动在调色板上循环显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用循环来加载和/或修改数据并使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆