レイヤーを追加する

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...