การเพิ่มเลเยอร์

การสร้างภาพข้อมูลเชิงโต้ตอบด้วย plotly ใน R ระดับกลาง

Adam Loy

Statistician, Carleton College

เพิ่มขนาดข้อความของสไลเดอร์เป็น 40 และเปลี่ยนสีเป็นสีดำ

การสร้างภาพข้อมูลเชิงโต้ตอบด้วย plotly ใน R ระดับกลาง

เลเยอร์ข้อความ

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"))
  )

23-text-only-animation.gif

การสร้างภาพข้อมูลเชิงโต้ตอบด้วย plotly ใน R ระดับกลาง

เลเยอร์จุด

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")
  )
การสร้างภาพข้อมูลเชิงโต้ตอบด้วย plotly ใน R ระดับกลาง

การปรับแต่งขั้นสุดท้าย

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)

23-polished.gif

การสร้างภาพข้อมูลเชิงโต้ตอบด้วย plotly ใน R ระดับกลาง

23-polished.gif

การสร้างภาพข้อมูลเชิงโต้ตอบด้วย plotly ใน R ระดับกลาง

มาฝึกกันเถอะ!

การสร้างภาพข้อมูลเชิงโต้ตอบด้วย plotly ใน R ระดับกลาง

Preparing Video For Download...