March 14, 2021

Bookmarks: R data visualization, ggplot2 plotting tips

Bookmarks for useful graphing tutorials in R. 

Types of plots possible with ggplot2

  • "Be awesome in ggplot2" - a visually beautiful guide to see what is possible. Great to get ideas for data visualization.

Formatting in general

Themes available for ggplot2 graphs

Modifying color, font, text size in ggplot2

Creating custom themes for ggplot2

Add subscripts, Greek letters, and other special characters to graph legends
Useful to add subscripts in axes, e.g. log10(FDR)

Adding annotations to plots

Color palettes and gradients:


Formatting x- and y-axes


geom_tile() for matrix data - heatmap


Fix label spacing in ggplot2 with ggrepel -- install.packages("ggrepel")
Use the R package, ggrepel, to add point label text that doesn't overlap.
Use functions ggrepel::geom_label_repel for boxed labels
Use function ggrepel::geom_text_repel for just text, no background

Ideas with ggrepel:
https://stackoverflow.com/questions/15624656/label-points-in-geom-point

Make an animated gif to better see point labels, with ggrepel:
https://mran.microsoft.com/snapshot/2017-02-28/web/packages/ggrepel/vignettes/ggrepel.html

Making a color gradient to label points, and formatting the legend
https://stackoverflow.com/questions/24265652/label-minimum-and-maximum-of-scale-fill-gradient-legend-with-text-ggplot2


Color code outliers in a box and whisker plot by a specific variable

Heatmaps


Combining figures




Cowplot R package

Making pdf files

Setting up Ubuntu 24.04.x LTS desktop and server, RStudio server, and JypyterLab at home

Why?  Set up a Linux server computer on a home network if: You want to run code that takes a long time to complete. Let it run on the server...