EthanCampbellHW1

First Assignment for DACSS.

Ethan Campbell
2022-02-02

Basic Visualization

Here we visulize the data set MPG and look into tank size and mpg on the hwy.

ggplot(data = mpg) +
  geom_point(mapping = aes(x = displ, y = hwy))

Here we start using a second aes function. (Size and Color)

ggplot(data = mpg) +
  geom_point(mapping = aes(x = displ, y = hwy, size = cty, color = hwy))

Adding and removing the legend. Change show.legend to False to turn it off.

ggplot(data = mpg) +
  geom_smooth(mapping = aes(x = displ, y = hwy, color = drv),
    show.legend = TRUE)

Here is the combination of the above sets.

ggplot(data = mpg) + 
  geom_point(mapping = aes(x = displ, y = hwy, color = drv)) +
  geom_smooth(mapping = aes(x = displ, y = hwy, linetype = drv, color = drv),
              show.legend = TRUE
              )