0

次の設定では、基本的な例に基づいて面グラフを作成します。入力の凡例を自動的に、またはプログラムで取得するにはどうすればよいですか。今のところ、1 つの項目「a」と最初の色の凡例のみを取得します。

from bokeh.plotting import *

...
patches([x2 for a in areas], list(areas.values()), color=colors, alpha=0.8,
    line_color=None, legend='a', title="hello chart")

legend().orientation = "top_right" # what other options, may here?
show()

値として凡例のパッチに渡す形式は何ですか、または凡例()をトリガーしてプロット内のすべての項目の項目と色を表示するにはどうすればよいですか?

4

2 に答える 2

2

bokeh で次のコメントを見つけました。

OK、これらの手描きの凡例はかなりぎこちなく、将来のリリースで改善される予定です

これは今のところ機能しています:

hold() # stop the curplot() 
# and add the legend just next to the data
x, y = 15.5, 0
for i,area in enumerate(areas):
    rect([x], [y], color=colors[i], width=0.3, height=400)
    text([x], [y], text=area, angle=0, text_font_size="8pt", text_align="center", text_baseline="middle")
    y = y + 100

show()
于 2014-08-17T22:40:34.320 に答える