Description
ggplot2 is a widely used graphics library in R and also part of the tidyverse. The tidyverse is a collection of R packages that share a common design philosophy, grammar, and data structures. Other…
Summary
- A quick introduction to ggplot2 How understanding the grammar of graphics will help you build any plot with ggplot2 ggplot2 is a widely used graphics library in R and also part of the tidyverse.
- The grammar of graphics ggplot2 is built on the grammar of graphics.
- The data and how data points are mapped to each other A set of geometric objects also referred to as geoms (visual marks that represent the data points like e.g.
- bar, dots, or lines) A coordinate system In addition to the base layers, ggplot2 offers many other layers to adjust plots through colouring, scaling, and faceting or adding statistical transformations to the data.
- The second plot (1D, discrete) shows that a plot still shows even if coord_cartesian() is not added to the code.