Site icon R-bloggers

ggpubr: Create Easily Publication Ready Plots

[This article was first published on Easy Guides, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
< !-- START HTML -->

The ggpubr R package facilitates the creation of beautiful ggplot2-based graphs for researcher with non-advanced programming backgrounds.

The current material presents a collection of articles for simply creating and customizing publication-ready plots using ggpubr. To see some examples of plots created with ggpubr click the following link: ggpubr examples.

ggpubr Key features:

  • Wrapper around the ggplot2 package with a less opaque syntax for beginners in R programming.
  • Helps researchers, with non-advanced R programming skills, to create easily publication-ready plots.
  • Makes it possible to automatically add p-values and significance levels to box plots, bar plots, line plots, and more.
  • Makes it easy to arrange and annotate multiple plots on the same page.
  • Makes it easy to change grahical parameters such as colors and labels.

Official online documentation: http://www.sthda.com/english/rpkgs/ggpubr.

Install and load ggpubr

  • Install from CRAN as follow:
install.packages("ggpubr")
  • Or, install the latest version from GitHub as follow:
# Install
if(!require(devtools)) install.packages("devtools")
devtools::install_github("kassambara/ggpubr")
  • Load ggpubr:
library("ggpubr")

Related articles

Facilitating Exploratory Data Visualization: Application to TCGA Genomic Data

Description: Plot one or a list of variables at once.

Contents:

  • Gene expression data
  • Box plots
  • Violin plots
  • Stripcharts and dot plots
  • Density plots
  • Histogram plots
  • Empirical cumulative density function
  • Quantile – Quantile plot

Add P-values and Significance Levels to ggplots

Description: Compute and add automatically p-values and significance levels to ggplots.

Contents:

  • Methods for comparing means
  • R functions to add p-values
    • compare_means()
    • stat_compare_means()
  • Compare two independent groups
  • Compare two paired samples
  • Compare more than two groups
  • Multiple grouping variables

Perfect Scatter Plots with Correlation and Marginal Histograms

Description: Create beautiful scatter plots with correlation coefficients and marginal histograms/density.

Contents:

  • Basic plots
  • Color by groups
  • Add concentration ellipses
  • Add point labels
  • Bubble chart
  • Color by a continuous variable
  • Add marginal plots
  • Add 2d density estimation
  • Application to gene expression data

Plot Means/Medians and Error Bars

Description: Plot easily means or medians with error bars.

Contents:

  • Error plots
  • Line plots
  • Bar plots
  • Add labels
  • Application to gene expression data

Bar Plots and Modern Alternatives

Description: Create easily basic and ordered bar plots, as well as, some modern alternatives to bar plots, including lollipop charts and cleveland’s dot plots.

Contents:

  • Basic bar plots
  • Multiple grouping variables
  • Ordered bar plots
  • Deviation graphs
  • Alternatives to bar plots
    • Lollipop chart
    • Cleveland’s dot plot

Add Text Labels to Histogram and Density Plots

Description: Create histograms/density plots and highlight some key elements on the plot.

ggplot2 – Easy Way to Mix Multiple Graphs on The Same Page

Description: Step by step guide to combine multiple ggplots on the same page, as well as, over multiple pages.

Contents:

  • Create some plots
  • Arrange on one page
  • Annotate the arranged figure
  • Align plot panels
  • Change column/row span of a plot
  • Use common legend for combined ggplots
  • Scatter plot with marginal density plots
  • Mix table, text and ggplot2 graphs
  • Insert a graphical element inside a ggplot
    • Place a table within a ggplot
    • Place a box plot within a ggplot
    • Add background image to ggplot2 graphs
  • Arrange over multiple pages
  • Nested layout with ggarrange()
  • Export plots

ggplot2 – Easy Way to Change Graphical Parameters

Description: Describe the function ggpar() [in ggpubr], which can be used to simply and easily customize any ggplot2-based graphs.

Contents:

  • Change titles and axis labels
  • Change legend position & appearance
  • Change color palettes
    • Group colors
    • Gradient colors
  • Change axis limits and scales
  • Customize axis text and ticks
  • Rotate a plot
  • Change themes
  • Remove ggplot components

Create and Customize Multi-panel ggplots: Easy Guide to Facet

Description: split up your data by one or more variables and to visualize the subsets of the data together.

Contents:

  • Facet by one grouping variables
  • Facet by two grouping variables
  • Modifying panel label appearance
< !--end rdoc--> < !-- END HTML -->

To leave a comment for the author, please follow the link and comment on their blog: Easy Guides.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.