Annotation is crucial for your dataviz

A collection of common dataviz caveats by Data-to-Viz.com




Annotation is a crucial component of a good dataviz. It can turn a boring graphic into a interesting and insightful way to convey information. Dataviz is often separated in two main types: exploratory and explanatory analysis. Annotation takes place for the second type.

Modern attention span for looking at things online is, on average, less than five seconds. So if you can’t grab attention within five seconds, you’ve likely lost your viewer. Adding accurate annotation can greatly help to grab audience attention. Use keywords, shapes, colors and other visuals to help them go straight to the point.

Annotation is a general concept, and hundreds of different ways to annotate a chart exist, depending on what the context is. Let’s study a few examples.

Example 1


The main danger when plotting a line chart is to end up with a spaghetti chart: having to many groups often result in a confusing figure where it is hard to detect any pattern. This topic is weel described here.

# Libraries
library(tidyverse)
library(hrbrthemes)
library(babynames)
library(viridis)

# Load dataset from github
data <- babynames %>% 
  filter(name %in% c("Mary","Emma", "Ida", "Ashley", "Amanda", "Jessica",    "Patricia", "Linda", "Deborah",   "Dorothy", "Betty", "Helen")) %>%
  filter(sex=="F")

# Plot
data %>%
  ggplot( aes(x=year, y=n, group=name, color=name)) +
    geom_line() +
    scale_color_viridis(discrete = TRUE) +
    theme(
      legend.position="none",
      plot.title = element_text(size=14)
    ) +
    ggtitle("A spaghetti chart of baby names popularity") +
    theme_ipsum()