diff --git a/visualize.Rmd b/visualize.Rmd index 4cb87f0..3009bdc 100644 --- a/visualize.Rmd +++ b/visualize.Rmd @@ -300,7 +300,7 @@ If you prefer to not facet in the rows or columns dimension, use a `.` instead o How are these two plots similar? -```{r echo = FALSE, out.width = "50%", fig.align="default"} +```{r echo = FALSE, out.width = "50%", fig.align="default", message = FALSE} ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy)) @@ -335,7 +335,7 @@ Here `geom_smooth()` separates the cars into three lines based on their `drv` va If this sounds strange, we can make it more clear by overlaying the lines on top of the raw data and then coloring everything according to `drv`. -```{r echo = FALSE} +```{r echo = FALSE, message = FALSE} ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) + geom_point() + geom_smooth(mapping = aes(linetype = drv)) @@ -354,7 +354,7 @@ knitr::include_graphics("images/visualization-geoms-4.png") Many geoms, like `geom_smooth()`, use a single geometric object to display multiple rows of data. For these geoms, you can set the `group` aesthetic to a categorical variable to draw multiple objects. ggplot2 will draw a separate object for each unique value of the grouping variable. In practice, ggplot2 will automatically group the data for these geoms whenever you map an aesthetic to a discrete variable (as in the `linetype` example). It is convenient to rely on this feature because the group aesthetic by itself does not add a legend or distinguishing features to the geoms. -```{r, fig.width = 3, fig.align = 'default', out.width = "33%"} +```{r, fig.width = 3, fig.align = 'default', out.width = "33%", message = FALSE} ggplot(data = mpg) + geom_smooth(mapping = aes(x = displ, y = hwy)) @@ -435,7 +435,7 @@ ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) + 1. Recreate the R code necessary to generate the following graphs. - ```{r echo = FALSE, fig.width = 3, out.width = "50%", fig.align = "default"} + ```{r echo = FALSE, fig.width = 3, out.width = "50%", fig.align = "default", message = FALSE} ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) + geom_point() + geom_smooth(aes(group = drv), se = FALSE)