3.2 Area chart: geom_area()

  • Draws an area plot.
    • A line plot filled to the y-axis.
    • Multiple groups are stacked.
ggplot(diamonds, aes(x = price)) +
  geom_area(stat = "bin")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(diamonds, aes(x = price, fill = cut)) +
  geom_area(stat = "bin")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.