1 of 20

Creating Accessible Data Visualizations in R

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

2 of 20

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 20

Today we’ll be covering

  • Adding Alternative Text to Plots�Explain what your visualization shows.
  • Color Palettes�How to select an accessible color palette.

1. Accessibility Checklist

4 of 20

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 20

Alt Text - Reason for Including Chart

Describing tells us what is plotted.�“This bar chart shows the number of ice cream cone eaten each month.”

Interpreting explains what we learn.�“Ice cream cone consumption peaks in July and is lowest in January.”�Point out the main pattern, comparison, or unusual feature, i.e. the take-home message.

Ask yourself: What does the chart show us? What evidence supports my takeaway?

​

​

Tip

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

6 of 20

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 20

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

8 of 20

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

9 of 20

Your Turn:

Including Alt Text in R

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

```

Note: an alternative syntax in quarto is #| fig-alt: "Include Alt Text"

​

10 of 20

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

11 of 20

Today we’ll be covering

  • Adding Alternative Text to Plots�Explain 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.alt�Add your Alt Text to plots using fig.alt

Recap: Alt Text Checklist

12 of 20

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

13 of 20

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, labels�Can your chart be interpreted based on another shape, pattern.

2. Colorblind friendly

14 of 20

Common accessible color schemes in R:

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

15 of 20

Your Turn:

Revisiting viridis

​

Add viridis layer to the penguin plot to make it accessible

16 of 20

Your Turn:

Adding patterns

​

Make the penguin plot accessible

17 of 20

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

18 of 20

Has the R community improved with TidyTuesday?

You can find out:

​

19 of 20

Resources

Alt text

Color Palettes

20 of 20

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.