Calmcode - ggplot: color

Color

1 2 3 4 5 6 7 8

Make sure that the following libraries are loaded before running other code.

library(ggplot2)
library(tidyverse)

There are two charts that we highlight in this video. Before running the code, try to predict what the result looks like.

Chart 1

ggplot() +
  geom_point(data=ChickWeight, aes(x=Time, y=weight, color=Chick))

Chart 2

ggplot() +
  geom_point(data=ChickWeight %>% mutate(Chick=as.character(Chick)),
             aes(x=Time, y=weight, color=Chick))