Bokeh 图表的颜色周期

Bokeh 图表的颜色周期,bokeh,Bokeh,我一直在尝试使用Bokeh v0.8.1创建一个包含许多~1000个箱线图的图。我注意到,每当我尝试使用bokeh.charts.BoxPlot函数时,我都会遇到一个错误,其中包含6个以上的BoxPlot import numpy as np from bokeh.charts import BoxPlot test = {} for i in range(0,7): test[str(i)] = np.random.normal(0,1,100) plot = BoxPlot(test

我一直在尝试使用Bokeh v0.8.1创建一个包含许多~1000个箱线图的图。我注意到,每当我尝试使用bokeh.charts.BoxPlot函数时,我都会遇到一个错误,其中包含6个以上的BoxPlot

import numpy as np
from bokeh.charts import BoxPlot
test = {}
for i in range(0,7):
    test[str(i)] = np.random.normal(0,1,100)
plot = BoxPlot(test)
show(plot)
堆栈跟踪:

ipython-input-321-6a3614410bf5> in <module>()
      4 for i in range(0,7):
      5     test[str(i)] = np.random.normal(0,1,100)
----> 6 plot = BoxPlot(test)
      7 show(plot)
/opt/pkg/python27/lib/python2.7/site-packages/bokeh/charts/builder/boxplot_builder.pyc in BoxPlot(values, marker, outliers, xscale, yscale, xgrid, ygrid, **kw)
     79     return create_and_build(
     80         BoxPlotBuilder, values, marker=marker, outliers=outliers,
---> 81         xscale=xscale, yscale=yscale, xgrid=xgrid, ygrid=ygrid, **kw
     82     )
     83 

/opt/pkg/python27/lib/python2.7/site-packages/bokeh/charts/_builder.pyc in create_and_build(builder_class, values, **kws)
     38     chart_kws = { k:v for k,v in kws.items() if k not in builder_props}
     39     chart = Chart(**chart_kws)
---> 40     chart.add_builder(builder)
     41 
     42     return chart

/opt/pkg/python27/lib/python2.7/site-packages/bokeh/charts/_chart.pyc in add_builder(self, builder)
    113     def add_builder(self, builder):
    114         self._builders.append(builder)
--> 115         builder.create(self)
    116 
    117         # Add tools if supposed to

/opt/pkg/python27/lib/python2.7/site-packages/bokeh/charts/_builder.pyc in create(self, chart)
    161     def create(self, chart=None):
    162         self._adapt_values()
--> 163         self._process_data()
    164         self._set_sources()
    165         renderers = self._yield_renderers()

/opt/pkg/python27/lib/python2.7/site-packages/bokeh/charts/builder/boxplot_builder.pyc in _process_data(self)
    185                 out_x.append(level)
    186                 out_y.append(o)
--> 187                 out_color.append(self.palette[i])
    188 
    189         # Store

IndexError: list index out of range
无论BoxPlot函数的预定义颜色列表是什么,新BoxPlot的颜色都已用完


有没有一种方法可以定义一个新的颜色列表(理想情况下是一个循环,如果它用完了,只需重复颜色)或完全禁用颜色?

循环颜色实现在bokeh上重复颜色。最近版本的IIRC 0.8中添加了图表。好像是个虫子。堆栈溢出确实不是进行此类讨论和跟踪问题的最佳场所

我已经打开了一个与图表上的cycle_颜色/调色板错误相关的问题,其中还包含了一个可以用来绕过该问题的快速方法。你可以看到。基本上,您可以显式地构建并传递您自己的足够大的调色板。如果您想提供帮助或其他反馈,请使用相关GH问题,因为我们更容易跟踪


谢谢

谢谢你的回复!我应该在我的问题中使用Bokeh的版本,所以对此表示歉意。我现在使用的是0.8.1,只是为了确保升级到0.8.2,这导致我在尝试导入bokeh.charts时遇到了不同的错误。我将在github上报告新的bug,一旦解决了,请返回此问题,看看新版本是否解决了此问题。我所面临的导入错误与我从0.8.1->0.8.2升级有关。在新安装的Bokeh上,此错误仍然存在于0.8.2中,因此我将此特定问题发布到github。@schultzmattd我已更新了答案,并提供了更详细的信息和相关GH问题的链接。