Plotting workshop in R

Woods Hole Oceanographic Institution

Online

December 1, 2021

1:00 pm - 5:00 pm

Instructors: Sarah K. Hu, David Geller-McGrath, Maria Pachiadaki

Helpers: Cory Berger, Brett Longworth, Dylan Titmuss

General Information

This workshop will go over our tips and tricks to create plots using ggplot2. Participants are encouraged to help one another and share their own "secrets" on graphs customization. The workshop is supported by WHOI's Internal Award "Expanding WHOI’s data science community of practice with foundational coding skills and topical workshops". This webpage was created using the Software Carpentry template. Software Carpentry aims to help researchers get their work done in less time and with less pain by teaching them basic research computing skills.

Who: The course is aimed at WHOI's technical staff, graduate students and other researchers. Participants need to have basic knowledge of R. Participants need to register here.

Where: This training will take place online. The instructors will provide you with the information you will need to connect to this meeting.

When: December 1, 2021. Add to your Google Calendar.

Requirements: Participants must have access to a computer with a Mac, Linux, or Windows operating system (not a tablet, Chromebook, etc.) that they have administrative privileges on. They should have a few specific software packages installed (listed below).

Accessibility: We are dedicated to providing a positive and accessible learning environment for all. Please notify the instructors in advance of the workshop if you require any accommodations or if there is anything we can do to make this workshop more accessible to you.

Contact: Please email mpachiadaki@whoi.edu , sarah.hu@whoi.edu or sbeaulieu@whoi.edu for more information.


Code of Conduct

We will be conforming to Carpentries' Code of Conduct.


Collaborative Notes

We will use this collaborative document for chatting, taking notes, and sharing URLs and bits of code.


Schedule

December 1st

01:00 pm Welcome!
01:05 pm Intro to ggplot2: Create Scatterplots!
01:25 pm Faceting
01:40 pm Modifying themes, titles, axes and legends
02:00 pm Coffee break
02:10 pm Modifying themes, titles, axes and legends-continued
02:25 pm Customize colors
02:50 pm Coffee break
03:00 pm Barplots, boxplots, violinplots
03:40 pm Creating multiple panels
03:50 pm Coffee break
04:00 pm Save plots
04:10 pm Create interactive time series plots
04:30 pm Wrap-up
04:35 pm Postworkshop survey
04:40 pm Q&A
05:00 pm END

Workshop Tutorial

Plotting in R


Useful Material

The following material might be useful.

Data Visualization with ggplot2 Cheatsheet

Base R Cheat sheet

R Language Definition


Setup

To participate in a this workshop, you will need access to software as described below. In addition, you will need an up-to-date web browser.

We maintain a list of common issues that occur during installation as a reference for instructors that may be useful on the Configuration Problems and Solutions wiki page.

Install the videoconferencing client

If you haven't used Zoom before, go to the official website to download and install the Zoom client for your computer.

Set up your workspace

Like other Carpentries workshops, you will be learning by "coding along" with the Instructors. To do this, you will need to have both the window for the tool you will be learning about (a terminal, RStudio, your web browser, etc..) and the window for the Zoom video conference client open. In order to see both at once, we recommend using one of the following set up options:

This blog post includes detailed information on how to set up your screen to follow along during the workshop.

R

R is a programming language that is especially powerful for data exploration, visualization, and statistical analysis. To interact with R, we use RStudio.

Install R by downloading and running this .exe file from CRAN. Also, please install the RStudio IDE. Note that if you have separate user and admin accounts, you should run the installers as administrator (right-click on .exe file and select "Run as administrator" instead of double-clicking). Otherwise problems may occur later, for example when installing R packages.

Video Tutorial

Instructions for R installation on various Linux platforms (debian, fedora, redhat, and ubuntu) can be found at <https://cran.r-project.org/bin/linux/>. These will instruct you to use your package manager (e.g. for Fedora run sudo dnf install R and for Debian/Ubuntu, add a ppa repository and then run sudo apt-get install r-base). Also, please install the RStudio IDE.