grafify: Make 5 powerful ggplot2 graphs quickly with R
Written by Matt Dancho on June 15, 2021
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.
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. 👇
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:
- Scatter Bar SD
- Scatter Box SD
- Scatter Violin SD
- Scatter Box 3D
- BONUS: Before and After Plots!!!
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!
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:
- Load Libraries: Load
- Import Data: We’re using the
mpgdataset that comes with
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 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 3: Dotviolin Plot
Next, we can make a Dotviolin Plot that shows a custom violin plot / dotplot combination. Simply use
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
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
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.
Step 1: Watch my Free 40-Minute Webinar
Learning data science on your own is hard. I know because IT TOOK ME 5-YEARS to feel confident.
AND, I don’t want it to take that long for you.
So, I put together a FREE 40-minute webinar (a masterclass) that provides a roadmap for what worked for me.
Literally 5-years of learning, consolidated into 40-minutes. It’s jammed packed with value. I wish I saw this when I was starting… It would have made a huge difference.
Step 2: Take action
For my action-takers, if you are ready to take your skills to the next level and DON’T want to wait 5-years to learn data science for business, AND you want a career you love that earns you $100,000+ salary (plus bonuses), and you’d like someone to help you do this in UNDER 6-MONTHS or less….
Then I can help with that too. There’s a link in the FREE 40-minute webinar for a special price (because you are special!) and taking that action will kickstart your journey with me in your corner.
Get ready. The ride is wild. And the destination is AMAZING!
👇 Top R-Tips Tutorials you might like:
- mmtable2: ggplot2 for tables
- ggdist: Make a Raincloud Plot to Visualize Distribution in ggplot2
- ggside: Plot linear regression with marginal distributions
- DataEditR: Interactive Data Editing in R
- openxlsx: How to Automate Excel in R
- officer: How to Automate PowerPoint in R
- DataExplorer: Fast EDA in R
- esquisse: Interactive ggplot2 builder
- gghalves: Half-plots with ggplot2
- rmarkdown: How to Automate PDF Reporting
- patchwork: How to combine multiple ggplots
- Geospatial Map Visualizations in R
Want these tips every week? Join R-Tips Weekly.