시작하기무료로 시작하기

슈팅가드 vs 스몰포워드

스포츠 미디어 에이전시에서 득점 생산성 측면에서 슈팅가드와 스몰포워드의 중요성을 비교하는 블로그를 제작하려고 합니다. 두 포지션 각각에 대해 경기당 득점과 어시스트를 다른 글리프 색상, 크기, 투명도로 표시하는 산점도를 만들어 달라고 했어요.

nba 데이터셋은 "SG""SF"로 필터링되어 있으며, Bokeh 소스 객체 shooting_guardssmall_forwards로 미리 로드되어 있어요. 또한 "player", "team", "field_goal_perc"를 표시하는 HoverTool도 만들어 두었습니다.

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

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

강의 보기

연습 안내

  • shooting_guards를 사용해 경기당 득점 대 평균 어시스트의 원(circle) 글리프를 추가하고, size는 16픽셀, fill_color는 빨간색으로, 글리프 투명도 관련 키워드 인수에는 0.2를 지정하세요.
  • 스몰포워드의 경기당 득점 대 평균 어시스트를 나타내는 원 글리프를 추가하고, 채움색은 초록색, 크기는 6픽셀, 글리프 투명도는 0.6으로 설정하세요.

실습형 인터랙티브 연습

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

TOOLTIPS = [("Name", "@player"), ("Team", "@team"), ("Field Goal %", "@field_goal_perc{0.2f}")]
fig = figure(x_axis_label="Assists", y_axis_label="Points", title="Shooting Guard vs Small Forward", tooltips=TOOLTIPS)

# Add glyphs for shooting guards
fig.circle(x="assists", y="points", source=shooting_guards, legend_label="Shooting Guard", ____=____, ____="____", ____=____)

# Add glyphs for small forwards
fig.circle(x="assists", y="points", source=small_forwards, legend_label="Small Forward", ____=____, ____="____", ____=____)

output_file(filename="sg_vs_sf.html")
show(fig)
코드 편집 및 실행