LoslegenKostenlos loslegen

Adding dropdown menus

Indirect selection is a powerful tool that can facilitate exploration when overplotting is present. In the lesson, you saw this with overlaid time series plots. In this exercise, you will consider how indirect selection can help you "call out" specific points on a scatterplot.

plotly and crosstalk have already been loaded for you.

Diese Übung ist Teil des Kurses

Intermediate Interactive Data Visualization with plotly in R

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Create a shared data object keyed by state
state_data <- SharedData$new(us2017, ___ = ___, ___ = ___)

# Enable indirect selection by state
state_data %>%
  plot_ly(x = ~home_owners, y = ~house_price, hoverinfo = "text", text = ~state) %>%
  add_markers(size = ~population, marker = list(sizemode = "diameter")) %>%
  ___(___ = ___)
Code bearbeiten und ausführen