demo/crosstalk-filter-lines.R

library(crosstalk)
library(ggplot2)
library(gapminder)
library(plotly)

sd <- highlight_key(gapminder)

g <- ggplot(sd, aes(year, lifeExp, color = country, group = country)) +
  geom_line()

bscols(widths = c(12, 12),
  filter_select("country", "Country:", sd, ~ country),
  ggplotly(g)
)

Try the plotly package in your browser

Any scripts or data that you put into this service are public.

plotly documentation built on Oct. 22, 2023, 1:14 a.m.