How I analyze 100+ ggplots at once
Written by Matt Dancho
Visualizing big data is next to impossible. As soon as I have 12 plots, that’s where my ability to use native ggplot suffers. That is until I found
trelliscopejs is like
ggplot2 faceting on steroids. This may seem crazy, but the benefit is that when you have 20, 30, or even 100+ plots you need to analyze,
trelliscopejs is the solution!
And, I’m going to get you up and running with
trelliscopejs in under 5-minutes:
- I’ll teach you how to make 20+ ggplot facets using trelliscopejs
- BONUS: I’ll not only show you how to make static ggplots, but I’ll even show you how to use the plotly integration for interactivity
SPECIAL ANNOUNCEMENT: How To Become A 6-Figure Business Scientist (Even In A Recession) on June 28th
Inside the workshop I’ll share how to become exactly what companies need right now (and earn 17% more than a data scientist):
What: How To Become A 6-Figure Business Scientist (Even In A Recession)
When: Wednesday June 28th, 2pm EST
How It Will Help You: Data science in 2023 has changed. The 10+ person data science team is out. And the one-person Business Scientist is in. I’ll show you how to become a 1-person data science team inside my LIVE 6-figure business scientist masterclass.
Price: Does Free sound good?
How To Join: 👉 Register Here
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
trelliscopejs package in my 5-minute YouTube video tutorial.
What you make in this R-Tip
By the end of this tutorial, you’ll make the 20+ ggplots for exposing insights in your big data.
Analyzing 20+ ggplots (made with
Thank You Developers.
Before we move on, please recognize that
trelliscopejs was developed by Ryan Hafen (follow Ryan on Twitter). Thank you for everything you do!
Also, the full documentation for trelliscopejs can be accessed here.
Let’s dive into using
trelliscopejs so we can analyze 100+ ggplots.
Step 1: Load the Libraries and Data
First, run this code to:
- Load Libraries: Load
- Import Data: We’re using the
mpg dataset that comes with
Get the code.
Our data looks like this. We want to understand how Highway Fuel Economy (
hwy) varies with
displ (engine size) but we want to see if there is any differences between
The mpg dataset
Step 2: Make a ggplot
Next, let’s make a basic ggplot of fuel economy vs engine displacement.
Get the code.
This produces the following plot of
Our basic ggplot
Step 3: Apply the trelliscopejs magic!
Listen, I’m telling you this next part is straight-up magic!
Seriously, I now use this simple trick to analyze 100+ ggplots at once.
- Use the
- This replaces a
- And makes 100’s of ggplots (as many as your heart desires)
- In this case, we facet by
manufacturer and end up with 15 plots to analyze.
Get the code.
The result is the trelliscope plot with 15 ggplots by manufacturer.
We've transformed our ggplot into a faceted trelliscope with 15 plots by manufacturer
Step 4: Customize the Trelliscopejs
This is really cool!! You can add additional labels like max/min displacement by plot.
Customize the trelliscope with labels & filters
BONUS: Make your trelliscope interactive!!!
If you thought you were done…
We’re just gettin’ started!
THIS is the magic of trelliscope!!
- Add interactivity with the Plotly integration inside of
- Simply add
as_plotly = TRUE
Get the code.
Check out the interactivity from plotly!!
Interactivity with the plotly-trelliscopejs integration
You learned how to use the
trelliscopejs library to not only create 100’s of static ggplots but create 100’s of interactive plotly plots. Great work! 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.
Do You Need Help Becoming A Business Data Scientist Right Now?
YOU know the feeling. Being unhappy with your current job.
Promotions aren’t happening. You’re stuck. Hopeless. Confused…
And you’re praying that the next data science interview will go better than the last 12…
… But you know it won’t. Not unless you take control of your career.
The good news is…
I Can Help You Speed It Up.
I’ve helped 5,897+ students learn data science for business from an elite business consultant’s perspective.
I’ve worked with Fortune 500 companies like S&P Global, Apple, MRM McCann, and more.
And I built a training program that gets my students life-changing data science careers (don’t believe me? see my testimonials here):
6-Figure Data Science Job at CVS Health ($125K)
Senior VP Of Analytics At JP Morgan ($200K)
50%+ Raises & Promotions ($150K)
Lead Data Scientist at Northwestern Mutual ($175K)
2X-ed Salary (From $60K to $120K)
2 Competing ML Job Offers ($150K)
Promotion to Lead Data Scientist ($175K)
Data Scientist Job at Verizon ($125K+)
Data Scientist Job at CitiBank ($100K + Bonus)
Whenever you are ready, here’s how I can help you:
Here’s the system that has gotten aspiring data scientists, career transitioners, and life long learners data science jobs and promotions…
Join My 5-Course R-Track Program
(And Become The Data Scientist You Were Meant To Be...)
P.S. - Samantha landed her NEW Data Science R Developer job at CVS Health (Fortune 500). This could be you.