The top 5 ggplot2 extension packages for easy data visualization in the R programming language. Want to learn more? Check out my comprehensive online course on Data Visualization in R Using ggplot2 & Friends: https://statisticsglobe.com/online-course-data-visualization-ggplot2-r
R code of this video:
# install.packages("ggplot2") # Install & load ggplot2
library(ggplot2)
data(iris) # Load example data
head(iris) # Head of example data
# install.packages("ggdist") # Install & load ggdist
library(ggdist)
ggplot(data = iris, # Draw raincloud plot
aes(x = Sepal.Length,
y = Species,
fill = Species)) +
geom_dotsinterval(side = "bottom",
scale = 0.5,
position = position_nudge(y = - 0.07)) +
stat_slab(scale = 0.5,
position = position_nudge(y = 0.07)) +
geom_boxplot(width = 0.1)
# install.packages("ggiraph") # Install & load ggiraph
library(ggiraph)
my_ggiraph <- ggplot(data = iris, # Create interactive plot
aes(x = Sepal.Length,
y = Sepal.Width,
color = Species)) +
geom_line_interactive(aes(tooltip = Species,
data_id = Species),
linewidth = 2)
girafe(ggobj = my_ggiraph) # Draw interactive plot
# install.packages("patchwork") # Install & load patchwork
library(patchwork)
my_patchwork1 <- ggplot(data = iris, # Create first plot
aes(x = Sepal.Length,
y = Sepal.Width,
color = Species)) +
geom_point()
my_patchwork2 <- ggplot(data = iris, # Create second plot
aes(x = Sepal.Length,
y = Sepal.Width,
color = Species)) +
geom_line()
my_patchwork3 <- ggplot(data = iris, # Create third plot
aes(x = Species,
y = Sepal.Width,
fill = Species)) +
geom_boxplot()
my_patchwork1 + my_patchwork2 / my_patchwork3 # Draw plot composition
# install.packages("ggstatsplot") # Install & load ggstatsplot
library(ggstatsplot)
ggbetweenstats(data = iris, # Violin plot with stats
x = Species,
y = Sepal.Length)
# install.packages("gganimate") # Install & load gganimate
library(gganimate)
ggplot(iris, # Animated scatter plot
aes(x = Sepal.Length,
y = Sepal.Width,
colour = Species,
group = 1L)) +
geom_point(size = 5) +
transition_states(Species,
transition_length = 1,
state_length = 1.5)
Follow me on Social Media:
LinkedIn – Joachim Schork Profile: https://www.linkedin.com/in/joachim-schork/LinkedIn – Statistics Globe Page: https://www.linkedin.com/company/statisticsglobe/
LinkedIn – R Programming Group for Discussions & Questions: https://www.linkedin.com/groups/12555223/
LinkedIn – Python Programming Group for Discussions & Questions: https://www.linkedin.com/groups/12673534/
X (Formerly Twitter): https://x.com/JoachimSchork
Facebook – Joachim Schork Profile: https://www.facebook.com/joachim.schork/Facebook – Statistics Globe Page: https://www.facebook.com/statisticsglobecom/
Facebook – R Programming Group for Discussions & Questions: https://www.facebook.com/groups/statisticsglobe
Facebook – Python Programming Group for Discussions & Questions: https://www.facebook.com/groups/statisticsglobepython
Instagram: https://www.instagram.com/statisticsglobecom/
TikTok: https://www.tiktok.com/@statisticsglobe