1
我一直在嘗試使用Bokeh(v0.8.1)創建一個包含許多(〜1000s)boxlot的情節。我注意到,每當我嘗試使用bokeh.charts.BoxPlot函數時,我都會遇到有超過6個盒子圖的情節。圖表的顏色週期
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
看來,無論預定義的顏色列表中箱線圖功能已用完的顏色新的箱線圖。
有沒有辦法定義一個新的顏色列表(理想情況下,一個循環,只會重複顏色,如果它用完了)或完全禁用着色?
感謝您的回覆!我應該把我在問題中使用的散焦版本,所以我很抱歉。我現在在0.8.1上,爲了確保升級到0.8.2,導致我在嘗試導入bokeh.charts時遇到了不同的錯誤。我將在github上報告這個新bug,一旦解決了這個問題,就會回到這個問題來看看新版本是否可以解決這個問題。 – schultzmattd
我正面臨的導入錯誤與我從0.8.1-> 0.8.2升級有關。在全新的Bokeh安裝中,這個錯誤仍然存在於0.8.2中,所以我將這個特定問題發佈到github上。 – schultzmattd
@schultzmattd我已經用更好的細節和相關GH問題的鏈接更新了答案。 –