1. Learn
  2. /
  3. Courses
  4. /
  5. Building Web Applications with Shiny in R

Exercise

Add interactive plot output

Similar to creating interactive tables, you can easily turn a static plot created using ggplot2 into an interactive plot using the plotly package. To render an interactive plot, use plotly::renderPlotly(), and display it using plotly::plotlyOutput().

Remember that just like with other render functions, the code inside plotly::renderPlotly() should be wrapped in curly braces {}!

Instructions

100 XP
  • Create an interactive plot of the top 10 most popular names by sex and year. Name the output "plot_trendy_names" and use the function plot_trends() to generate the plot.
  • Display the plot in the UI.