레이어 추가

R로 배우는 plotly 중급 인터랙티브 데이터 시각화

Adam Loy

Statistician, Carleton College

슬라이더 텍스트를 40으로 늘리고 색상을 검정으로 변경.

R로 배우는 plotly 중급 인터랙티브 데이터 시각화

텍스트 레이어

world_indicators %>%
  plot_ly(x = ~income, y = ~co2) %>%
  add_text(
    x = 6500, y = 1, text = ~year, frame = ~year,
    textfont = list(size = 150, color = toRGB("gray80"))
  )

텍스트만 있는 애니메이션.

R로 배우는 plotly 중급 인터랙티브 데이터 시각화

포인트 레이어

world_indicators %>%
  plot_ly(x = ~income, y = ~co2) %>%
  add_text(
    x = 6500, y = 1, text = ~year, frame = ~year,
    textfont = list(size = 150, color = toRGB("gray80"))
  ) %>%
  add_markers(frame = ~year, ids = ~country) %>%
  layout(
    xaxis = list(type = "log"), yaxis = list(type = "log")
  )
R로 배우는 plotly 중급 인터랙티브 데이터 시각화

마무리 다듬기

world_indicators %>%
  plot_ly(x = ~income, y = ~co2) %>%
  add_text(
    x = 6500, y = 1, text = ~year, frame = ~year,
    textfont = list(size = 150, color = toRGB("gray80"))
  ) %>%
  add_markers(frame = ~year, ids = ~country) %>%
  layout(
    xaxis = list(type = "log"), yaxis = list(type = "log"),
    showlegend = FALSE
  ) %>%
  animation_slider(hide = TRUE)

다듬은 결과 애니메이션.

R로 배우는 plotly 중급 인터랙티브 데이터 시각화

최종 결과 애니메이션.

R로 배우는 plotly 중급 인터랙티브 데이터 시각화

연습해 봅시다!

R로 배우는 plotly 중급 인터랙티브 데이터 시각화

Preparing Video For Download...