Loading...
「ツール」は右上に移動しました。
利用したサーバー: wtserver1
185いいね 3,029 views回再生

Best ggplot2 Extensions for R Data Visualization | ggdist, ggiraf, patchwork, ggstatsplot, gganimate

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-co...

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:   / linkedin   – Statistics Globe Page:   / statisticsglobe  
LinkedIn – R Programming Group for Discussions & Questions:   / 12555223  
LinkedIn – Python Programming Group for Discussions & Questions:   / 12673534  
X (Formerly Twitter): https://x.com/JoachimSchork
Facebook – Joachim Schork Profile:   / facebook   – Statistics Globe Page:   / statisticsglobecom  
Facebook – R Programming Group for Discussions & Questions:   / statisticsglobe  
Facebook – Python Programming Group for Discussions & Questions:   / statisticsglobepython  
Instagram:   / statisticsglobecom  
TikTok:   / statisticsglobe  

コメント