Albert Rapp Profile picture
May 5 16 tweets 6 min read Twitter logo Read on Twitter
I used to think tables are boring.

But they can be beautiful & engaging.

Here's a nice example from @infobeautiful.

It uses many eye-catching elements but you don't need them to create a great table.

Just stick to these guidelines 🧵#dataviz A huge table describing wha...
Let's start with a not so great table and improve it.

Here's a table I would have created just a few months ago.

Not so sexy, right? Let's clean that up. Image
1. Avoid vertical lines

The above table uses waaaay to many grid lines.

Without vertical lines, the table will look less cramped.

Have a look for yourself. Image
2. Texts go left & Numbers go right

Notice that I have switched from all-center-aligned to

1️⃣ right-align numbers
1️⃣ left-align texts.

This improves readability and makes the table more harmonious.

Here's an example: Which column is easier to read? Image
3. Use better column names

Currently, the column names take up too much space.

We can avoid that by combining columns.

This also avoids repeating partial names in multiple columns. Image
4. Use groups instead of repetitive columns

The island column is somewhat repetitive.

In cases like these, I'd rather remove the column.

Instead, I would group the table using additional rows. Image
5. Remove missing numbers

Notice that our table has a lot of zeroes in it.

For better readability, let us replace the zeroes with something more lightweight. Image
6. Add summary lines

Our table already looks much cleaner.

In this format, we could even add MORE information at little cost.

For example, we could add a summary (like counts or means) for each group. Image
Short recap:

1. Avoid vertical lines
2. Align columns
3. Better column names
4. Groups instead of repetitive columns
5. Remove missing numbers
6. Add summaries

These tips are dead-simple and use no fancy visuals.

But visuals are great so let me give you a few bonus guidelines.
Visuals can spice up most tables.

Here's another table that we're going to enhance. Image
7. Transform columns into heatmaps

This table shows that Sierra Leone had the lowest life expectancy in 2007 (among the depicted countries).

We can figure this out by comparing the numbers in the most recent column one-by-one.

Let's make that more obvious with a visual cue. Image
7b. Use multiple heatmap columns

We could also do the same with the 1957 column.

You could even do that with all columns. But I am not sure whether that's a good idea here.

After all, we do not want to overload our table with colors. Image
8. Add sparklines

Did you notice that each depicted country increased its life expectancy in each year.

Sure, you may have an idea that this is the case.

But to be sure, you will have to compare each cell of each row.

Let's make that easier with so-called sparklines. Image
9. Add bullet charts

The data set that was used to create this table contains many more countries.

But showing all of that information would make the table HUUUGE.

Nevertheless, we can use all the data to put the depicted data into context, e.g. with a so-called bullet-chart. Image
10. Add intervals/ranges

You can put means or medians into context using confidence intervals or quantile ranges.

Here's an example of that.

Beware though that I have erroneously labeled the intervals as confidence intervals instead of quantile ranges.

That's a wrap. 🥳

Now you're equipped with guidelines to polish your next table.

Let me know if you've enjoyed this thread by liking the start of this thread below. ☺️

And for more content like this, you can follow @rappa753.

See you next time! 👋

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Albert Rapp

Albert Rapp Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @rappa753

Apr 28
I hate code duplication. It's just a sure way to bloat code and do copy-and-paste mistakes 🙈

In Shiny, modules help me to avoid that.

BONUS: They move the app's logic to separate + reusable functions for cleaner code.

Here's how modules work. #rstats
Let's build an app that displays a scatterplot of two variables of a given data set.

Let's imagine that each data set needs its own page in our app. Here's how that could look. ImageImage
Every element of our app will need to get a unique ID. And we will need to repeat that for every data set.

For two data sets a non-modularized Shiny UI could look something like this.

Notice how I have to append "_iris" each time for the second tabPanel / data set. Image
Read 11 tweets
Apr 4
Paired bar charts suck at comparing values. The only reason they're used all the time is because they are easy to create.

But there are better alternatives that are just as easy.

Here's how to create 4 better alternatives with #rstats.
0 // Where's the code?

The code for all plots can be found at albert-rapp.de/posts/ggplot2-…

This thread walks you through the code quickly.
1 // Dot plot

Instead of using bars next to each other, why not points on the same line?

Makes comparison suuper easy.

And it takes only a geom_point() layer. Dead-simple, right?

I think it's even easier to create than a paired bar chart.
Read 15 tweets
Mar 31
Tired of lackluster visualizations that don't tell you anything?

Discover how storytelling and nuanced color use can
- transform your bar charts.
- inform readers on key insights & actions

Here's a step-by-step guide (with full code at the end). #rstats
Here's our starting point.

Note that this tutorial is a ggplot2 recreation of

(And once you've mastered the technique you can enhance this visual with advanced stats beyond comparing error rates to average.)
// Labels on y-axis

First, move the names to the y-axis.

This is important when the labels are real names instead of IDs.

No one likes to tilt their head for reading.
Read 19 tweets
Mar 29
Data visualization doesn't have to be complicated. 🤯

In fact, ggplot makes it dead-simple to implement some of the most effective dataviz principles.

Here are six dataviz principles that are so easy that any beginner’s course should teach them. #rstats
1 // Make sure your labels are legible

This one is super easy to fix. Any beginner can do it.

Img 1: Way too small fonts & unclear labels
Img 2: Fixed with labs() and theme_gray(base_size = 20)
Img 3: Full code ImageImageImage
2 // Use a minimal theme

As a rule of thumb, you should minimize everything that could potentially distract your audience.

That’s why I usually recommend to use a minimal theme: Just use `theme_minimal()` instead of `theme_gray()`. Image
Read 9 tweets
Mar 25
Manually sifting through mountains of data is annoying. 🥱

But with the point & click interface of analytics dashboards, data exploration is more fun.

And building a dashboard is simple too, especially with R & Shiny. Here's how to get started now. #rstats
1 // Data

First, you need data.

It's always fun to work with your personal data, so I will use my the last three months of my Twitter analytics data. You can download yours at analytics.twitter.com
2 // Data cleaning

Next, do a bit of data cleaning. In my case, I just have to clean the column names and select a few columns.

{janitor} and {dplyr} make that easy.
Read 13 tweets
Mar 11
Ever found yourself stuck trying to visualize data that's only available as PDF?

I faced this exact issue when recreating an interactive plot on the democracy index.

Here's how I circumvented that issue with #rstats. (plus code at the end)
0 // Find the data

The data in question can be downloaded at eiu.com/n/campaigns/de…

This will give you access to a PDF that contains multiple pages of data.
1 // Do manual copy work

I was contemplating using a PDF data extractor. But here it was only a couple minutes worth of work to copy all the data into a text file.
Read 14 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(