Introduction to ggplot2
ggplot2
is a part of the tidyverse collection of R packages. It's used to create powerful, layered, and customizable data visualizations.
To use it, load the libraries:
library(tidyverse)
library(ggplot2)
And disable scientific notation to make plots more readable:
options(scipen = 999)
Basic Structure of a ggplot2 Plot
Every ggplot2 visualization is constructed in layers:
ggplot(data, aes(x, y)) +
geom_function()
data
: the dataset being used;aes()
: aesthetic mappings (define how variables are mapped to axes or other properties);geom_*()
: geometry layer (determines how the data will be displayed, such as bars, points, or lines).
Summary
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 1
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 4
Introduction to ggplot2
Swipe to show menu
ggplot2
is a part of the tidyverse collection of R packages. It's used to create powerful, layered, and customizable data visualizations.
To use it, load the libraries:
library(tidyverse)
library(ggplot2)
And disable scientific notation to make plots more readable:
options(scipen = 999)
Basic Structure of a ggplot2 Plot
Every ggplot2 visualization is constructed in layers:
ggplot(data, aes(x, y)) +
geom_function()
data
: the dataset being used;aes()
: aesthetic mappings (define how variables are mapped to axes or other properties);geom_*()
: geometry layer (determines how the data will be displayed, such as bars, points, or lines).
Summary
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 1