Skip to content

Commit 35cdd93

Browse files
authored
Merge pull request #345 from UBC-DSCI/patch-regr-scatter-scale
Explain `dollar_format` function in regr-1
2 parents 86a8f38 + a13c041 commit 35cdd93

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

regression1.Rmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ want to predict (sale price) on the y-axis.
117117
\index{ggplot!geom\_point}
118118
\index{visualization!scatter}
119119

120+
> **Note:** Given that the y-axis unit is dollars in Figure \@ref(fig:07-edaRegr),
121+
> we format the axis labels to put dollar signs in front of the house prices,
122+
> as well as commas to increase the readability of the larger numbers.
123+
> We can do this in R by passing the `dollar_format` function
124+
> (from the `scales` package)
125+
> to the `labels` argument of the `scale_y_continuous` function.
126+
120127
```{r 07-edaRegr, message = FALSE, fig.height = 4, fig.width = 5, fig.cap = "Scatter plot of price (USD) versus house size (square feet)."}
121128
eda <- ggplot(sacramento, aes(x = sqft, y = price)) +
122129
geom_point(alpha = 0.4) +

0 commit comments

Comments
 (0)