Exercise

# Adding details to a plot using point shapes, color, and reference lines

Adding additional details to your explanatory plots can help emphasize certain aspects of your data. For example, by specifying the `pch`

and `col`

arguments to the `plot()`

function, you can add different point shapes and colors to show how different variables or subsets of your data relate to each other. In addition, you can add a new set of points to your existing scatterplot with the `points()`

function, and add reference lines with the `abline()`

function.

This exercise asks you to use these methods to create an enhanced scatterplot that effectively shows how three variables in the `Cars93`

data frame relate to each other. These variables are:

`Price`

: the average sale price for a car`Max.Price`

: the highest recorded price for that car`Min.Price`

: the lowest recorded price for that car

Instructions

**100 XP**

- Use the
`plot()`

function to create a scatterplot of the`Max.Price`

variable versus the`Price`

variable, specifying the`pch`

and`col`

parameters so the data points are represented as red solid triangles. The`pch`

value to plot solid triangles is 17. - Use the
`points()`

function to add a second set of points to your scatterplot, representing`Min.Price`

versus`Price`

, where the new data points are represented as blue solid circles. The`pch`

value for solid circles is 16. - Use the
`abline()`

function to add a dashed equality reference line (i.e., a line with y-intercept 0 and slope 1). See`abline()`

to learn what arguments`a`

and`b`

refer to.