1 of 19

Creating Accessible Data Visualizations in R

Accessibility Lab created by Max Devon, Liza Dubinsky, and Laurie Baker

2 of 19

TidyTuesday and Data Viz Accessibility

Findings from Silvia and Liz’s Project

  • TidyTuesday: Weekly social project for data visualization in R
  • 3% of the data visualizations shared on Twitter had alternative text
  • 84% were described by default as "Image"

Canelón, Silvia, & Hare, Elizabeth. (2021). Revealing Room for Improvement in Accessibility within a Social Media Data Visualization Learning Community (v1.0). csv,conf,v6. Zenodo. https://doi.org/10.5281/zenodo.4743271

3 of 19

Today we’ll be covering

  • Adding Alternative Text to PlotsExplain what your visualization shows.
  • Color PalettesHow to select an accessible color palette.

1. Accessibility Checklist

4 of 19

Writing Alt-text for Data Viz

Tip

  • Chart type
  • Of type data (x and y)
  • Reason for including chart

Tip

  • Chart type
  • Of type data (x and y, color)
  • Reason for including chart

5 of 19

Alt Text - Your Turn

I. Horizontal bar chart. Dominican Republic, Peru, Venezuela, and Ecuador are the top four countries responsible for the bean origin of 154, 115, 87, and 86 bars respectively. Bars are color-coded by continent, with most beans originating from the Americas (blue).

II. Horizontal bar chart of the number of chocolate bars manufactured in the U.S.A by country and continent of bean origin. Dominican Republic, Peru, Venezuela, and Ecuador are the top four countries responsible for the bean origin of 154, 115, 87, and 86 bars respectively. Bars are color-coded by continent, with most beans originating from the Americas (blue).

III. Horizontal bar chart of the number of chocolate bars manufactured in the U.S.A by country and continent of bean origin.

IV. Number of chocolate bars manufactured in the U.S.A by country and continent of bean origin. Dominican Republic, Peru, Venezuela, and Ecuador are the top four countries responsible for the bean origin of 154, 115, 87, and 86 bars respectively. Bars are color-coded by continent, with most beans originating from the Americas (blue).

Tip

  • Chart type
  • Of type data (x and y, color)
  • Reason for including chart

6 of 19

Alt Text - Your Turn

I. Horizontal bar chart. Dominican Republic, Peru, Venezuela, and Ecuador are the top four countries responsible for the bean origin of 154, 115, 87, and 86 bars respectively. Bars are color-coded by continent, with most beans originating from the Americas (blue).

II. Horizontal bar chart of the number of chocolate bars manufactured in the U.S.A by country and continent of bean origin. Dominican Republic, Peru, Venezuela, and Ecuador are the top four countries responsible for the bean origin of 154, 115, 87, and 86 bars respectively. Bars are color-coded by continent, with most beans originating from the Americas (blue).

III. Horizontal bar chart of the number of chocolate bars manufactured in the U.S.A by country and continent of bean origin.

IV. Number of chocolate bars manufactured in the U.S.A by country and continent of bean origin. Dominican Republic, Peru, Venezuela, and Ecuador are the top four countries responsible for the bean origin of 154, 115, 87, and 86 bars respectively. Bars are color-coded by continent, with most beans originating from the Americas (blue).

Tip

  • Chart type
  • Of type data (x and y, color)
  • Reason for including chart

7 of 19

Your Turn:

Practice Writing the Alt Text

Tip

Tell the audience about the problem through a story, ideally a person.

Tip

  • Chart type
  • Of type data (x and y, color)
  • Reason for including chart

8 of 19

Your Turn:

Including Alt Text in R

```{r, fig.alt = “Include Alt Text.”}

```

9 of 19

Including Alt Text in R

```{r, fig.alt = c("Informative alt text for plot 1", "Informative alt text for plot 2")}

plot1

plot2

```

Two plots

10 of 19

Today we’ll be covering

  • Adding Alternative Text to PlotsExplain what your visualization shows. Include:
  • Chart type
  • Of type data (x and y, color)
  • Reason for including chart

  • Add to plots in R using fig.altAdd your Alt Text to plots using fig.alt

Recap: Alt Text Checklist

11 of 19

Color blindness affects roughly 300 million people worldwide. CR Fereira highlights two important steps to improving your visualization

https://towardsdatascience.com/two-simple-steps-to-create-colorblind-friendly-data-visualizations-2ed781a167ec

12 of 19

Steps to making your plots colorblind friendly

  • 1. Choose the right colors�Choose colors so your chart can be seen.
  • 2. Use different shapes, patterns, text, labelsCan your chart be interpreted based on another shape, pattern.

2. Colorblind friendly

13 of 19

Common accessible color schemes in R:

  • viridis, e.g. scale_fill_viridis_d()
  • RColorBrewer, e.g. ColorBin()

14 of 19

Your Turn:

Revisiting viridis

Add viridis layer to the penguin plot to make it accessible

15 of 19

Make your visualizations more accessible by including

  • Alt Text
    • Text: Chart type of data types where reason for including.
    • R code chunk: fig.alt = “Alt text”
  • Colorblind Friendly color scheme
    • RColorBrewer: colorBin, scale_<aes>_viridis()

4. Recap

16 of 19

Has the R community improved with TidyTuesday?

You can find out:

17 of 19

Resources

Alt text

Color Palettes

18 of 19

Thank you and a Survey!

  • Our goal is to continue to improve the lab and ask about what you’ve learned.
  • We plan to share the lab more broadly with other data science classrooms and are interested in what you thought about it.
  • You will find the link on Google Classroom and you will be asked whether you consent to be in the educational study which has been approved by the Bates Institutional Review Board. If you consent, you are asked the survey questions. If you decline, you are not asked the survey questions. Your feedback is completely anonymous and no identifying information is collected.
  • I will not look at the results of the survey until after the semester finishes and grades are returned.

19 of 19

Your Turn:

Adding patterns

Make the penguin plot accessible