시작하기무료로 시작하기

색상 막대 추가하기

에이전시에서 플롯을 보는 사람들이 글리프 색이 바뀌는 임계값을 이해할 수 있도록 ColorBar를 포함해 달라고 요청했어요.

이전 연습 문제의 figure, mapper, 그리고 글리프가 모두 제공되어 있어요.

이 연습은 강의의 일부입니다

Bokeh로 배우는 인터랙티브 데이터 시각화

강의 보기

연습 안내

  • ColorBar를 가져오세요.
  • mapper의 해당 키를 사용해 color_bar를 만들고, 너비를 8픽셀로 설정하세요.
  • figure의 오른쪽에 color_bar를 레이아웃에 추가하세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Import ColorBar
____

mapper = linear_cmap(field_name="assists", palette=RdBu8, low=min(nba["assists"]), high=max(nba["assists"]))
fig = figure(x_axis_label="Steals", y_axis_label="Assists", title="Steals vs. Assists")
fig.circle(x="steals", y="assists", source=source, color=mapper)

# Create the color_bar
color_bar = ____(color_mapper=____, width=____)

# Update layout with color_bar on the right
fig.____(____, "____")
output_file(filename="steals_vs_assists_color_mapped.html")
show(fig)
코드 편집 및 실행