Introduction
ggpubr creates publication-ready plots. It simplifies ggplot2 for standard visualizations.
Basic ggpubr
library(ggpubr)
# Box plot
ggboxplot(df, x = "group", y = "value")
# Violin plot
ggviolin(df, x = "group", y = "value", add = "mean")
# Bar plot
ggbarplot(df, x = "group", y = "value")
Adding Statistics
# Add p-value
ggboxplot(df, x = "group", y = "value") +
stat_compare_means()
# Compare groups
ggboxplot(df, x = "group", y = "value") +
stat_compare_means(comparisons = list(c("A", "B")))
Customization
ggboxplot(df, x = "group", y = "value",
color = "group",
palette = "jco",
add = "jitter",
rug = TRUE)
Summary
ggpubr simplifies creating standard plots. Use it for publication figures.