Visualization in R
This repository has teaching materials for a 3 hour, hands-on Visualization in R workshop led at a relaxed pace. The workshop will give participants an overview of the basics of the R package, ggplot2, for the generation of publication-worthy figures. Participants will also use several R packages (ggrepel, pheatmap, etc.) for more advanced plotting methods, such as learning how to change from a wide data format to a long data format for plotting purposes, how to label and/or repel individual data points on a scatter plot, and how to create heatmaps and volcano plots.
- Creating basic plots: Exploring and customizing basic plots (scatter plots, histograms, boxplots, etc.) using the ggplot2 package.
- Exporting graphics: Saving plots for use outside of the R environment.
- Wrangling data for visualization: Changing data formats for visualization purposes
- Data assessment with volcano plots and heatmaps: Learning how to create volcano plots and label interesting data points and how to create heatmaps with the pheatmap R package and interpret the output
These materials are developed for a trainer-led workshop, but also amenable to self-guided learning.
|Setting up for plotting||15 min|
|Basic plotting with ggplot2||75 min|
|Advanced visualizations||90 min|
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.packages(c("ggplot2", "RColorBrewer", "pheatmap", "ggrepel", "reshape"))
Load the libraries to make sure the packages installed properly:
library(ggplot2) library(RColorBrewer) library(pheatmap) library(ggrepel) library(reshape)
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.