The process
This week, a student of my ggplot2 course asked how I go from a dataset to a polished graph.
It's a common (and important!) question. So here's a quick overview of my process:
1️⃣ Explore first
I start by making lots of quick, messy plots. No styling, just raw exploration to understand what's in the data and what story might be hiding.
I love using ggplot2 here: easy to filter, tweak, and switch chart types just by changing the geom.
Pro tip: The gt_plt_summary() function from gtExtras gives a great first glimpse of your dataset:
2️⃣ List the options
Next, I brainstorm every chart type that could work. It's a good mental exercise, and harder than it sounds!
Even with just two columns, you could make a barplot, lollipop, donut, pie, circular barplot, choropleth, waffle chart and more.
To help with this, I made Data to Viz: a decision tree to explore all your options.
Pro tip: Don't limit yourself to standard charts. Grab pen and paper and try sketching something new.
3️⃣ Pick the right one
Every chart type has its pros and cons. Here's what I usually consider when picking the right one:
But honestly, the most important thing, by far, is to know what question you're trying to answer.
At the end of the day, your user should understand the key message in less than 20 seconds.
If you're trying to show a rank, a barplot is very powerful. But a treemap fails!
If you want to highlight the proportion of a specific group, it's the opposite!
4️⃣ Add annotation
Choosing a chart is just the beginning. Now you need to tell the story.
Highlight key points. Write a clear, compelling title. Add direct annotations.
Your reader should never have to guess the takeaway.
Check the "Best Graphs" section of the R Graph Gallery. Notice how most charts are annotated?
Here's an example by Cédric Scherer, who I'm currently co-writing the ggplot2 course with!
Pro tip: your legend can often be replaced by an annotation
5️⃣ Polish the design
Your chart must look clean and professional. If it looks clumsy, people won't trust it.
Design is hard to teach, and many of my students struggle with it.
Pro tip: Follow Dataviz Inspiration for daily exposure to great work.
Pro tip: Try my Dataviz Design Game to learn 17 key design rules.
6️⃣ Repeat
Dataviz is iterative.
You'll cycle through these steps more than once—and that's completely normal.
We all do it!
PS: I often present this process as a 1-hour interactive talk. If you'd like to boost your team's dataviz skills, feel free to drop me an email!
PPS: 1,443 of you have enrolled in my online courses (R, matplotlib, ggplot2). Thank you so much! 🎉🙏
See you next week,
Yan
Enjoyed this?
Get one short, actionable dataviz tip every Saturday. Join 19,000+ data people.