Session Ready
Exercise

Add colours to your plot: radio buttons

Radio buttons are used when you want to present the user with several options and ask them to choose one. They have a choices parameter that defines the different options the user can choose from, and a selected argument that defines which choice is selected initially. Note that there is no value parameter, though you can think of selected as having a similar role.

Instructions
100 XP

The code for the Shiny app from the last exercise is provided. Your task is to add radio buttons that give the user a choice of color to use for the plot. Specifically:

  • Add radio buttons to the UI with ID "color", a label of "Point color", and four choices: "blue", "red", "green", "black".
  • Add code to the server such that the points in the plot will have the color that is selected in the radio buttons (line 22).