시작하기무료로 시작하기

gridplot 사용하기

부동산 중개인은 멜버른의 네 지역에서 주택 면적과 가격의 관계가 어떻게 달라지는지 확인하고 싶어 합니다:

"Northern", "Western", "Eastern", "Southern".

각 지역마다 하나의 서브플롯을 보여 주는 gridplot을 사용하기에 딱 좋은 상황이에요!

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

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

강의 보기

연습 안내

  • gridplot을 임포트하세요.
  • 원하는 지역으로 melb를 필터링해 df를 만드세요.
  • fig에 서클 글리프를 추가하는 코드를 완성하세요. source에서 건물 면적 열을 x, 가격을 y, legend_labelregion으로 설정합니다.
  • 서브플롯을 두 열의 그리드로 표시하세요.

실습형 인터랙티브 연습

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

# Import gridplot
from ____.____ import ____
plots = []

# Complete for loop to create plots
for region in ["Northern", "Western", "Southern", "Eastern"]:
  df = melb.loc[melb["region"] == ____]
  source = ColumnDataSource(data=df)
  fig = figure(x_axis_label="Building Area (Meters Squared)", y_axis_label="Price")
  fig.circle(x="____", y="____", source=____, legend_label=____)
  fig.yaxis[0].formatter = NumeralTickFormatter(format="$0a")
  plots.append(fig)

# Display plot
output_file(filename="gridplot.html")
show(____(____, ncols=____))
코드 편집 및 실행