2016-07-13 1 views
1

Bokeh 내의 스팬 주석에 레이블을 추가하려면 어떻게해야합니까? 지금까지 라벨을 본 적이 있습니다. 레이블을 라벨에 묶는 더 좋은 방법이 있습니까?Bokeh의 범위에 레이블 추가 0.12

답변

3

라벨을 스팬에 첨부하려면 위치를 동일하게 설정하면됩니다. 이 라벨의 y 좌표 화소 지정이 예에서

from bokeh.models import Span, Label 
from bokeh.plotting import figure 

p = figure(plot_height=400, plot_width=400) 

# Initialize your span and label 
my_span = Span(location=0, dimension='height') 
p.renderers.extend([my_span,]) 

my_label = Label(x=0, y=200, y_units='screen', text='Test label') 
p.add_layout(my_label) 

참고y_units=screen 인자를 이용하여 조정한다. 플롯 좌표에있을 수도 있습니다. 단지 screen 인수를 전달하지 마십시오.

그런 다음과 같이 자신의 위치를 ​​업데이트 할 수 있습니다

: 참고로

def update(): 
    my_span.set(location=my_slider.value) 
    my_label.set(x=my_slider.value)