3.6.1

ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) + 
      geom_point() + 
      geom_smooth(se = FALSE)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

p1 <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) + 
            geom_point() + 
            geom_smooth()

p2 <- ggplot() + 
            geom_point(data = mpg, mapping = aes(x = displ, y = hwy)) + 
            geom_smooth(data = mpg, mapping = aes(x = displ, y = hwy))
grid.arrange(p1, p2, ncol = 2)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

p6_1 <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
              geom_point() +
              geom_smooth(se = FALSE)
p6_2 <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
              geom_point() +
              geom_smooth(mapping = aes(group = drv), se = FALSE)
p6_3 <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) +
              geom_point() +
              geom_smooth(se = FALSE)
p6_4 <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
              geom_point(mapping = aes(color = drv)) +
              geom_smooth(se = FALSE)
p6_5 <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
              geom_point(mapping = aes(color = drv)) +
              geom_smooth(mapping = aes(linetype = drv), se = FALSE)
p6_6 <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) +
              geom_point(aes(fill = drv), shape = 21, color = "white", stroke = 2, size = 3)
grid.arrange(p6_1, p6_2, p6_3, p6_4, p6_5, p6_6, ncol = 2)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'