This video shows off the powers of ggplot (a plotting package in R) with a script that automatically generates dozens of plots by adapting to the types of columns in a dataset.

ggplot2 is a powerful R package for quickly generating plots from a dataset, and it is quite easy to use. ggplot is one of the best reasons to learn R.

If you haven’t used ggplot before, I recommend going through this tutorial: Plotting in R for Biologists to learn about how to quickly make plots for yourself in R using ggplot.

In the video I show how powerful ggplot2 is using a script that makes a bunch of different plots by combining the columns of a dataset in different ways.
The script automatically figures out whether your data is tab-separated or comma-separated. Then it learns what kind of data you have in each column, like numbers or categorical variables (called factors in R). Some columns will have the same value in all the rows, or completely unique categorical values. There is no way to plot those, so they are ignored. The script then goes through all numerical columns and useful categorical columns, and it plots combinations of these columns in a way that makes sense for the data. The plot types are bar charts, box plots, and scatter plots.

This allows you to get a quick view of the patterns in a dataset and how the variables relate to each other. This script is most useful if you are already familiar with ggplot and coding in R, so take a look at the Plotting in R for Biologists tutorial videos if you want to learn the basics of plotting R.

If you want to try out the automagical script for yourself, download it here:

Automagical_R_Plotting_Script.R

Categories: Video

Related Posts

Video

How to write a bash script that takes user input

Quick guide to writing a bash script on the Mac/Linux command-line Writing a bash script is important for setting up pipelines to process data or run a series of different tools. It also makes your Read more...

Video

For bioinformatics, which language should I learn first?

Python, R, and bash are the most useful languages to learn right now in bioinformatics. Deciding which one to start with depends on your goals… Welcome to the very first episode of the OMGenomics show. Read more...

Video

Is bioinformatics a lucrative career option for biologists?

In this video we talk about supply and demand for bioinformaticians, and why it is hard for professors to recruit bioinformatics post-docs — which is good for PhDs who want to fill that gap.