Calmcode - ggplot: subtitle

Subtitle

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

Pay attention to the subtitle keyword in ggtitle.

ggplot() +
  geom_point(data=ChickWeight, aes(x=Time, y=weight), size=1) +
  ggtitle("Weights of Chickens over Time",
          subtitle="Notice how the variance of weight also increases.")