Ggplot - History

Ggplot Graphic Plot

Composition instead of addition

ggplot worked using function composition instead of addition.

So instead of addition:

ggplot(mtcars, aes(wt, mpg)) + 
  geom_point() + 
  geom_smooth()

You wrote something a composition:

geom_smooth(geom_point(ggplot(mtcars, aes(wt, mpg))))

Pipe

An interesting historical note is that if I'd discovered the pipe earlier, there never would've been a ggplot2, because you could write ggplot graphics as

ggplot(mtcars, aes(wt, mpg)) %>%
  geom_point() %>%
  geom_smooth()

Documentation / Reference







Share this page:
Follow us:
Task Runner