0
질문 업데이트 :bokeh의 vbar는 비 선택 색상 및 알파를 지원하지 않습니까?
바 plot에서 특정 종을 선택하는 방법, 선택되지 않은 막대는 색상이 변경됩니까? 각 막대 위에 텍스트를 표시하는 방법은 무엇입니까?
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)
답변 해 주셔서 감사합니다. 그것은 처음 두 가지 질문을 해결하고 해결합니다. 귀하의 제안으로 코드를 업데이트하고 링크 된 그래프에 대한 별도의 질문을 여기에서 요청하십시오. https://stackoverflow.com/questions/47579840/how-to-link-vbar-with-circle-plots-using-bokeh –