0
質問を更新:bokehのvbarは非選択色とアルファをサポートしていませんか?
バープロットで特定の種を選択するには、選択されていないバーは色が変わりますか? 各バーの上にテキストを表示するにはどうすればよいですか?
from bokeh.sampledata.iris import flowers
from bokeh.plotting import figure, output_file, show
from bokeh.models import ColumnDataSource, CategoricalColorMapper
from bokeh.layouts import column, row
#color mapper to color data by species
mapper = CategoricalColorMapper(factors = ['setosa','versicolor', 'virginica'],\
palette = ['green', 'blue', 'red'])
output_file("plots.html")
#group by species and plot barplot for count
species = flowers.groupby('species')
source = ColumnDataSource(species)
p = figure(plot_width = 800, plot_height = 400, title = 'Count by Species', \
x_range = source.data['species'], tools = 'box_select')
p.vbar(x = 'species', top = 'petal_length_count', width = 0.8, source = source,\
nonselection_fill_color = 'gray', nonselection_fill_alpha = 0.2,\
color = {'field': 'species', 'transform': mapper})
show(p)
あなたの答えをありがとう!最初の2つの質問を解決して解決します。私はあなたの提案でコードを更新し、リンクされたグラフについて別の質問をここに:https://stackoverflow.com/questions/47579840/how-to-link-vbar-with-circle-plots-using-bokeh –