Skip to content

Latest commit

 

History

History
 
 

publication_perfect

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Publication Perfect

Audience Computational skills required Duration
General - researchers Intermediate R 1-session in-person or online workshop (~ 6 hours of trainer-led time)

Description

One of the biggest challenges in disseminating your research is visualizing the results in a way that is meaningful, easy to interpret and aesthetically pleasing. Oftentimes, the extensive time dedicated to generating experimental results can rival the creation and optimization of their figures. With a point and click environment, you can spend hours or even days tweaking the settings to get the perfect figure - only to realize that you now have to repeat this process for the remaining data. This process can be especially challenging when needing to perform customizations or when pivoting your figures to adhere to guidelines from conferences, journals or other publishing platforms.

In this tutorial, we introduce an efficient and reproducible workflow in R for creating publication-ready figures. We will introduce ggplot2 syntax to create custom plots, and we will explore how to determine the type of plots most appropriate for your data. We will explore how to ensure consistency between figures using custom theme and color selections, with an emphasis on colorblind-friendly palettes from the RColorBrewer and viridis packages. We will also examine methods for enhancing our plots with functions from the ggpubr and cowplot packages, especially regarding layout and labeling of figures. Finally, we will conclude with an activity to use what we have learned to reproduce a published figure.

This is a hands-on tutorial in which the data and code will be distributed to participants who wish to follow along. All tutorial lessons and materials will be hosted on GitHub pages. Participants will be required to have R and RStudio downloaded and installed on their personal computers, in addition to any required R packages. This tutorial assumes an intermediate level of R knowledge.

Learning Objectives

  • Determine the plot types best for visualizing a given dataset
  • Define the syntax for creating a plot using ggplot2
  • Generate plots for various data types using ggplot2
  • Explain how to create multiple plots using the same themes, styles, and colors
  • Discuss how to quickly alter figures to meet a different set of requirements (different journal or conference)

Schedule

Part I

Time Topic Instructor
13:00 - 13:10 Workshop Introduction Mary
13:10 - 13:30 Introduction to dataset and considerations for choosing appropriate plotting methods Radhika
13:30 - 14:15 Visualization package ggplot2 basic syntax and plot types Radhika
14:15 - 14:20 Break
14:20 - 14:45 Consistent plots with custom themes Mary
14:45 - 15:15 Application of plotting basics Radhika

Part II

Time Topic Instructor
13:00 - 13:10 Workshop Introduction Mary
13:10 - 14:00 Customization of scales and color palettes Mary
14:00 - 14:30 Aligning and labeling plots with cowplot Radhika
14:30 - 14:35 Break
14:35 - 15:15 Adding annotations and including statistical comparisons with ggpubr Jihe
15:15 - 15:45 Incorporating external packages to extend plotting functionality Meeta
15:45 - 15:50 Creating final figure Mary
15:50 - 15:55 Pivoting publications Mary
15:55 - 16:00 Wrap-up and exit survey Mary

Dataset

Download the R project and data for this workshop:

  • In preparation for Part I: Part I R data and project. Decompress and move the folder to the location on your computer where you would like to perform the analysis.
  • In preparation for Part II: Part II R data and project. Decompress and move the folder to the location on your computer where you would like to perform the analysis.

Installation Requirements

Download the most recent versions of R and RStudio for your laptop:

Install the required R packages by running the following code in RStudio:

# Install CRAN packages
install.packages("tidyverse")
install.packages("cowplot")
install.packages("ggpubr")
install.packages("RColorBrewer")
install.packages("viridis")
install.packages("scales")
install.packages("VennDiagram")
install.packages("pheatmap")
install.packages("png")
install.packages("ggrepel")
install.packages("ggplotify")
install.packages("magick")

Load the libraries to make sure the packages installed properly:

# Load R libraries
library(cowplot)
library(ggpubr)
library(RColorBrewer)
library(viridis)
library(scales)
library(tidyverse)
library(VennDiagram)
library(pheatmap)
library(png)
library(ggrepel)
library(ggplotify)
library(magick)

These materials have been developed by members of the teaching team at the Harvard Chan Bioinformatics Core (HBC). These are open access materials distributed under the terms of the Creative Commons Attribution license (CC BY 4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.