애니메이션 다듬기

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

Adam Loy

Statistician, Carleton College

사용자 지정

애니메이션 옵션

  • 프레임 간 시간
  • 프레임 전환
  • 슬라이더 모양

플로팅 옵션

  • 글리프 색, 모양, 크기
  • 축 라벨, 변환
  • 도구 설명(예: 호버 텍스트)
R로 배우는 plotly 중급 인터랙티브 데이터 시각화

애니메이션 옵션

기본 설정의 애니메이션.

ani <- world_indicators %>%
  plot_ly(x = ~income, y = ~co2) %>%
  add_markers(frame = ~year, 
              ids = ~country, 
              showlegend = FALSE) %>%
  layout(xaxis = list(type = "log"),
         yaxis = list(type = "log"))
R로 배우는 plotly 중급 인터랙티브 데이터 시각화

애니메이션 옵션

기본 설정의 애니메이션.

ani %>%
  animation_opts(
      frame = 500, 
      transition = frame,
      easing = "linear",
      redraw = TRUE
   )
R로 배우는 plotly 중급 인터랙티브 데이터 시각화

속도 높이기

frame = 300으로 빠르게 설정한 산점도 애니메이션.

ani %>%
  animation_opts(frame = 300)
R로 배우는 plotly 중급 인터랙티브 데이터 시각화

프레임 사이 일시정지

각 프레임에 350ms 정지 시간을 둔 애니메이션.

ani %>%
  animation_opts(
     frame = 700, 
     transition = 350
  )
R로 배우는 plotly 중급 인터랙티브 데이터 시각화

튀는 점 효과

easing = "bounce"를 사용한 애니메이션.

ani %>%
  animation_opts(easing = "bounce")

기본 easing 옵션:

"linear", "quad", "cubic", "sin", "exp", "circle", "elastic", "back", "bounce"

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

슬라이더 옵션

기본 설정의 애니메이션.

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

슬라이더 제거

슬라이더 없는 애니메이션.

ani %>%
  animation_slider(hide = TRUE)
R로 배우는 plotly 중급 인터랙티브 데이터 시각화

슬라이더 텍스트 편집

슬라이더에서 접두사 "year: " 제거.

ani %>%
  animation_slider(
     currentvalue = list(prefix=NULL)
  )
R로 배우는 plotly 중급 인터랙티브 데이터 시각화

슬라이더 텍스트 편집

슬라이더 텍스트 크기를 40으로 키우고 색을 검은색으로 변경.

ani %>%
  animation_slider(
     currentvalue = list(prefix=NULL,
        font = list(
           color = "black", 
           size = 40
        )
     )
  )
R로 배우는 plotly 중급 인터랙티브 데이터 시각화

연습해 봅시다!

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

Preparing Video For Download...