Advanced ggplotting

  1. For this exercise, use your newly-developed ggplot chops to create some nice graphs from your own data (If you do not have a good data frame to use for graphics, use one of the many built-in data frames from R (other than mpg, which we are using in class)). Experiment with different themes, theme base sizes, aesthetics, mappings, and faceting. When you are finished, try exporting them to high quality pdfs, jpgs, eps files, or other formats that you would use for submission to a journal.

In this exercise, I encourage you to improve your graphics with elements that we have not (yet) covered in ggplot. For example, can you change the labels on a facet plot so that they are more informative than the variable names that are supplied from your data frame? Can you figure out how to add text annotations, lines and arrows to your graph? Can you figure out how to use custom colors that you have chosen for your fills and lines? Your resources for these explorations are google, Stack Overflow – and your TAs!

Here are some more resources available to you that should guide you in making better visualizations:

  1. R Graph Gallery : A collection of useful plot types and aesthetic design tips, plus the associated code for each plot so you can follow along easily!

  2. R-Charts : Similar to R Graph Gallery, but also has customization tips for base plotting as well.

  3. Top 50 list Slightly outdated, but contains many interesting plots and visualizations that might apply to your dataset, including some more interactive ones, such as animated plots.