1. Learn
  2. /
  3. Courses
  4. /
  5. Intro to Computational Finance with R

Exercise

Add lines to the plot

Continue with the scatterplot. To indicate the central location of the point cloud, add a vertical line that indicates the mean of \(X\) and a horizontal line that indicates the mean of \(Y\).

Straight lines can be added to a plot with the abline() function. You can use the argument h to specify the y-values of horizontal lines, and the argument v to specify the x-values of vertical lines. For example, abline(h = 0) adds a horizontal line at 0.

Instructions

100 XP
  • Add a vertical line that indicates the mean of \(X\) and a horizontal line that indicates the mean of \(Y\).