1. Học hỏi
  2. /
  3. Khoa Học
  4. /
  5. Case Studies: Building Web Applications with Shiny in R

Connected

Bài tập

Make your plot interactive

plotly is a popular package for creating interactive plots in Shiny. There are several other packages for interactive visualizations, but we will use plotly largely because of its function ggplotly(), which converts a ggplot2 plot into an interactive one.

Hướng dẫn

100 XP

The code for the Shiny app from the last exercise is provided. Your task is to replace the ggplot2 plot with a plotly plot. Specifically:

  • Load the plotly package.
  • Replace the plot output function with plotlyOutput (line 20).
  • Replace the plot render function with renderPlotly (line 29).
  • Convert the existing ggplot2 plot to a plotly plot (line 31).