The aim of this talk is to have a lunch time style presentation on Accessibility when programming with R for Global Accessibility Awareness Day. Their are 2 main aims of this presentation:
Demonstration how to make a a graph using ggplot2 using R programming more accessible to users.
Showcase accessibility tools an R programmer has access to that may be of use to individuals or their colleagues.
There are multiple definition of accessibility and they depend on context. A good definition is “people are not excluded from using something on the basis of experiencing a disability” 1. In addition to having a range of abilities people also access information in different ways - for example people may be reading a report using a screen reader or navigating using a keyboard.
The first step in making our outputs more accessibility is being aware of the issues others may face.
Accessibility is an important aspect of R programming that is often overlooked. It’s ensuring equitability of the outputs you produce, ensuring the message you’re trying to convey or outputs created are reasonable accessible for everyone. Often this will improve you clarity of your message but also mean it can be consumed by a wider audience and aligned of the ethos of the Exploristics.
ggplot2A common task in R programming is to produce a graph to convey information on the underlying data, such as a trend or comparison between groups. The idiom is “a picture paints a thousand words” and a well designed and thought out figure can enhance your message but it can also distract from your message or alienate some of your intended audience.
As programmers get exposed to new technologies they inevitable want to showcase the new skills. This can lead to technology-driven decisions rather than business decisions - think of wrapping ggplot2 with as.plotly . That may not always a good idea1.
Another driver is as others publish complex graphs which can be seen as a proxy for technical competence. People compete to have the most technical graph with lots of functionality but little clarity or purpose.
ggplot2 was build on the grammar of graphics and provides is a “philosophy of producing graphs”. This provide a framework to produce accessible graphs but can be abused, that’s why Hadley Wickham refuses to allow dual-axis graphs in ggplot2 and limits the number of categories for comparison.
Use hierarchy and structure (Titles)
Reduce visual noise & clutter (labels, axis, images etc).
Be consistent with style within and between graphs
Use large sans serif fonts
Users can have a visual impairment that reduce their ability to distinguish colors. Online tools can simulate this. Therefore using color as the only medium to distinguish different groups/categories prevents some of your audience from being able to interpret your chart. Colour should never be the only factor to distinguish groups in your graph.
Consider the default colour scheme only using colour to indicate categories.
Some of your audience will use screen readers to view your graphs. Alt text is short for alternative text provides an ability for screen readers to provide an audio description of your graph or image. See Nicola Rennie Alt Text Blog for more details.
This is easily added for a Quarto or RMarkdown document but not for MS Word or PDF.
ggplot2 using the alt argument of the labs function.ggplot2::get_alt_text(plot)Add to Code chunks of Quarto or RMarkdown document
Full list available on RStudio Accessibility Features
Penn State Guide for charts link