A ggplot2 gallery of examples

Hi all,
I would like to invite you to check out a project I've been working on.

What this is (short answer):
A gallery of example plots using ggplot2

Where to find it:

Intended audience:

  • Primarily, my goal was to develop a gallery that would be useful to my students
  • I hope it may also be of use to others learning or using ggplot2. Especially those who find themselves googling how to implement details
  • Myself: it will be good to have a single place to go to see many of the plots I've made. Especially I don't remember the exact theme parameter to achieve a particular goal.

Project Status:

  • In progress, but I believe it is presentable and useful at this stage
  • To be used to accompany my teaching starting in September 2019
  • I intend to add a plot (or two) a week for the rest of 2019
  • The writeups are inconsistent across entries imo.

Feedback I am interested in:

  • Geometries that I should prioritize adding to the gallery
  • Difficulties you have with the gallery as a user interface
  • Critiques of the exposition.
  • Any other critiques that are offered constructively

What this is (long answer):

  • I would like this to eventually be a place that one could reasonably go to find an example of a plot similar to what one is intending and then go to the code. I often find myself googling how to achieve certain things.
  • The goal is not to make each plot as spectacular as possible. Also, I have deliberately made an effort to not make every plot the way I would make it for my own presentations.
  • This is not a site for teaching ggplot2 from scratch.

-Cheers and thanks for reading


Very helpful. Thanks. Great job to memory on charts that one hasn't used in a whil.

1 Like

This is great stuff, thanks for doing this! I've bookmarked this for future use.

One suggestion for the future, if you have time and think this is worthwhile: I've often found myself wondering how to do a very specific thing in ggplot2, for example, wanting to display numeric values with commas on the x- or y-axis. Usually I do an internet search and end up paging through search results from Stack Overflow, etc., trying to find questions and answers that address what I want to do.

It might be nice to have a document accompanying the plots that is basically an index of techniques used in the plots. For example, "displaying commas in axis values" -> [link to plot #2]. Otherwise a user would have to click through the plots one by one trying to find one that illustrates the technique. (For example, the plot of LeBron James's minutes shows how to use commas, but that's not really apparent looking at the thumbnail on the main page.)

But in any case, thanks again for the work you did on this!


RE a "how do I do this" ggplot2 reference, the RStudio cheatsheet does a great job at this:

Hi, These are great looking graphs.

But I have question regarding the graphs

  1. Why the bars are not starting right at the base of the x-axis or y-axis which in your case is starting a unit higher from the x-axis or y-axis?

  2. Is there a way to put minor ticks in both the axis?



I like this idea. I think it is worthwhile. I hope I have the time sooner rather than later.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.