Resources for Data Viz Accessibility

A selection of general and R-specific resources on how and why to make accessible data visualizations.

By Silvia Canelón in Education

September 23, 2021

Updated on 2021-11-19 to include a link to a series of educational blog posts written by Mara Averick that cover {highcharter} and the accessibility module in detail. Thank you Mara!

General resources

R resources

  • Liz Hare and I gave a talk earlier this year on alt text in data viz shared as a part of TidyTuesday on Twitter. After web-scraping alt text from TidyTuesday tweets we found that only 3% of data viz tweets had alt text to accompany them (over the first 3 years of the TidyTuesday project). Links to the video recording, slides, and resources at The talk includes guidelines on what makes effective alt text for data viz (complementary to those Amy Cesal includes in her post).

    Effective alt includes a description that conveys meaning in the data, variables on the axes, scale described within the description, description of the type of plot. Direct link to slide:

    Slide from our presentation summarizing the most useful alt-text features found among 196 data viz tweets

  • Post from RStudio on how to add alt text to visualizations produced in R Markdown using code chunk option fig.alt: New in knitr: Improved accessibility with image alt text.
    New in knitr v1.35: You can now add code chunk options inside the code chunk!

    Example updated thanks to a heads-up from Garrick:

    ggplot(data = penguins, aes(x = flipper_length_mm,
                                y = bill_length_mm,
                                color = species)) +
      geom_point(aes(shape = species), alpha = 0.8) +
        values = c("darkorange","purple","cyan4")) 

    Code chunk adapted from the RStudio blog post

    The previous example included fig.cap and fig.alt in the code chunk heading:

    ```{r fig.cap="Bigger flippers, bigger bills", fig.alt = "Scatterplot of flipper length by bill length of 3 penguin species, where we show penguins with bigger flippers have bigger bills."}
    ggplot(data = penguins, aes(x = flipper_length_mm,
                                y = bill_length_mm,
                                color = species)) +
      geom_point(aes(shape = species), alpha = 0.8) +
        values = c("darkorange", "purple", "cyan4")) 
  • The ggpattern R package developed by Mike FC supports filling ggplot2 geometries with patterns. If used judiciously, patterns can help make visualizations more accessible by providing an additional way to encode information without relying on color. Below is one example using ggpattern v0.2.2:

    penguinColors <- c("darkorange", "purple", "cyan4")
    ggplot(penguins, aes(species)) +
    geom_bar_pattern(aes(fill = species,
                         pattern = species,
                         pattern_color = species),
      fill = penguinColors,
      alpha = 0.1,
      size = 1,
      color = penguinColors,
      pattern_color = penguinColors,
      pattern_fill = penguinColors,
      pattern_spacing = 0.025
    ) +
    theme_minimal() +
    theme(legend.position = 'none')
    Bar chart showing 3 penguin species along the x axis and the number of observations on the y axis. The bar for the Adelie species uses the color orange and diagonal stripes, the bar for Chinstrap species uses the color purple and crosshatches, and the bar for the Gentoo species uses the color cyan and a dotted pattern.

    Different patterns mapped onto penguin species along with different colors

  • The Highcharter R package developed by Joshua Kunst adds interactivity to data viz using Highcharts JavaScript components designed with web accessibility in mind. The package has a learning curve, but lucky for us Mara Averick wrote an excellent series of blog posts on using the Highcharts accessibility module with {highcharter}.

    Scatterplot of the palmerpenguins dataset showing data points clustered by species and the highcharter package making it possible to focus on one cluster and identify the x and y values of a specific data point. In this case the data point is a Chinstrap penguin observation mapping to a flipper length of 201mm and bill length of 54.2mm. Explore this data viz with a screen reader in Mara's blog post:

    Interactive scatterplot from Mara’s post using color and shape to encode information about penguin species