grafify: Make 5 powerful ggplot2 graphs quickly with R

Written by Matt Dancho

The grafify package is a new R package that makes it easy to make 19-powerful ggplot2 graphs, ANOVAs, and comparison plots. I’ve been really enjoying it! In the next 10-minutes, we’ll learn how to make my 5 favorite grafify plots (with one line of code!):

  • Scatter-Bar (1), Scatter-Box (2), and Scatter-Violin (3) plots for plotting 2-variables
  • Scatter-Box 3D plots (4) for plotting 3-variables
  • BONUS: Before-and-After Plots (5) for showing State Change

This article was last updated on: February 15th, 2022.

R-Tips Weekly

This article is part of R-Tips Weekly, a weekly video tutorial that shows you step-by-step how to do common R coding tasks.

Here are the links to get set up. 👇

Video Tutorial

Learn how to use the grafify package in our 7-minute YouTube video tutorial.

What you make in this R-Tip

grafify is a new R package for making great-looking ggplot2 graphs quickly in R. It has 19 plotting functions that simplify common ggplot graphs and provide color-blind friendly themes. By the end of the tutorial, you’ll make:

  1. Scatter Bar SD
  2. Scatter Box SD
  3. Scatter Violin SD
  4. Scatter Box 3D
  5. BONUS: Before and After Plots!!!

Image Credit: grafify package

Thank You Developers.

Before we move on, please recognize that the grafify package was generously built and maintained with many hours of work by Avinash R. Shenoy. Thank you for all that you do!

The grafify Tutorial

The grafify package extends ggplot2 by adding several simplified plotting functions. Let’s explore the package by making 5 powerful plots (with one line of code)!

Load the Libraries and Data

First, run this code to:

  1. Load Libraries: Load grafify and tidyverse.
  2. Import Data: We’re using the mpg dataset that comes with ggplot2.

Get the code.

Plot 1: Scatterbar SD Plot

First, we can make a Scatterbar Plot that shows the data points along with error bars at a standard deviation. Simply use plot_scatterbar_sd().

Get the code.

Plot 2: Scatterbox Plot

Next, we can make a Scatterbox Plot that shows a custom boxplot / jitter plot combination. I’ve added a jitter point to show the distribution. Simply use plot_scatterbox().

Get the code.

Plot 3: Dotviolin Plot

Next, we can make a Dotviolin Plot that shows a custom violin plot / dotplot combination. Simply use plot_dotviolin().

Get the code.

Plot 4: Scatterbox 3D Plot

Next, we can make a 3D Scatterbox Plot that shows three variables using boxplot / jitter plot combination. This is great for drilling into multiple categories. Simply use plot_3d_scatterbox().

Get the code.

BONUS: Plot 5 - Before-After Plot

As a super cool bonus, we can make a Before-After Plot that shows changes between two states (in this case how various models changed in MPG Fuel Efficiency from 1999 to 2008). This is great for comparing two states. Simply use plot_befafter_colors().

Get the code.

We can see that most vehicles are improving in MPG from 1999 to 2008. However, there are a few that are going down. Most notably is the New Beetle going from 35MPG to about 27MPG, a decline of -23%.


We learned how to make 5 powerful plots using the grafify package. But, there’s a lot more to becoming a data scientist.

If you’d like to become a data scientist (and have an awesome career, improve your quality of life, enjoy your job, and all the fun that comes along), then I can help with that.

My Struggles with Learning Data Science

It took me a long time to learn how to apply data science to business. And I made a lot of mistakes as I fumbled through learning R.

I specifically had a tough time navigating the ever-increasing landscape of tools and packages, trying to pick between R and Python, and getting lost along the way.

If you feel like this, you’re not alone.

In fact, that’s the driving reason that I created Business Science and Business Science University (You can read about my personal journey here).

What I found out is that:

  1. Data Science does not have to be difficult, it just has to be taught from a business perspective
  2. Anyone can learn data science fast provided they are motivated.

How I can help

If you are interested in learning R and the ecosystem of tools at a deeper level, then I have a streamlined program that will get you past your struggles and improve your career in the process.

It’s my 5-Course R-Track System. It’s an integrated system containing 5 courses that work together on a learning path. Through 8 projects, you learn everything you need to help your organization: from data science foundations, to advanced machine learning, to web applications and deployment.

The result is that you break through previous struggles, learning from my experience & our community of 2653 data scientists that are ready to help you succeed.

Ready to take the next step? Then let’s get started.

Join My 5-Course R-Track Program
(Become A 6-Figure Data Scientist)