R로 배우는 plotly 중급 인터랙티브 데이터 시각화
Adam Loy
Statistician, Carleton College
일시적 선택
이전에 선택한 항목을 잊습니다

지속 선택
선택한 항목이 누적됩니다


shared_data <- world2014 %>% SharedData$new()
p1 <- shared_data %>%
plot_ly(x=~urban/population, y = ~co2, text = ~country) %>%
add_markers()
p2 <- shared_data %>%
plot_ly(x=~income, y = ~co2, text = ~country) %>%
add_markers()
subplot(p1, p2, titleX = TRUE, shareY = TRUE) %>%
hide_legend()
highlight()로 지속 선택 활성화
subplot(p1, p2, titleX = TRUE, shareY = TRUE) %>%
hide_legend() %>%
highlight(persistent = TRUE)


색상 선택기를 켜려면 dynamic = TRUE 추가
subplot(p1, p2, titleX = TRUE, shareY = TRUE) %>%
hide_legend() %>%
highlight(persistent = TRUE, dynamic = TRUE)
직접 조작
도형과 상호작용하여 선택합니다

간접 조작
차트 밖의 질의를 통해 선택합니다


world_indicators %>%
SharedData$new(key = ~country) %>%
plot_ly(x = ~year, y = ~income, alpha = 0.5) %>%
group_by(country) %>%
add_lines()
world_indicators %>%
SharedData$new(key = ~country, group = "Select a country") %>%
plot_ly(x = ~year, y = ~income, alpha = 0.5) %>%
group_by(country) %>%
add_lines() %>%
highlight(selectize = TRUE)

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