Learn to add legend to a plot using the legend() function. Specifically

  • position the legend within the plot
  • modify the layout using ncol and horiz arguments
  • add title using the title. set of arguments
  • modify the appearance and position of the legend box
  • modify the appearance of the text in the legend box