Mind the aspect ratio

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




Aspect ratio is defined as the ratio of the width to the height of a graphic. It can have a strong impact on the insights gained from your graphic.


Here is an example with a line plot showing yearly sunspot numbers from 1749 to 1983. (Sunspots are temporary phenomena on the Sun’s photosphere that appear as spots darker than the surrounding areas.). The dataset comes from this scientific publication originally, related by Andrews et al..

# Libraries
library(tidyverse)
library(hrbrthemes)

# Load dataset: comes with R
data <- data.frame(
  Year = as.numeric(time(sunspot.year)),
  Sunspots = as.numeric(sunspot.year)
)

# Plot
data %>%
  ggplot( aes(x=Year, y=Sunspots)) +
    geom_line() +
    ggtitle("Number of sunspots per year") +
    theme_ipsum() +
    theme(
      plot.title = element_text(size=12)
    )