class: right middle hide-count background-color: white background-image: url('assets/cover.jpg') background-size: cover <div class='title'><h1>A11Y IN R:</h1></div> <div class='subtitle'> Adapting <a class="title-link" href="https://fossheim.io/writing/posts/accessible-dataviz-design/">Sarah L. Fossheim's 10 dos and don'ts to keep in mind when designing accessible data visualizations</a></div> <div class="author">MAYA GANS</div> <div class="presentation">RStudio Meetup</div> --- class: right middle hide-count background-color: white background-image: url('assets/slide1.jpeg') background-size: cover <div class="quote">Accessibility should always be a focus when designing products, and the same goes when working with data visualizations and graphs.</div> <div class="quote-auth">- Sarah L Fossheim</div> --- class: hide-count background-color: white background-image: url('assets/slide234.jpeg') background-size: contain <div class="title-234"> 1. Don't rely on color to explain the data </div> .custom-code-css[ ```r ggplot(data, aes(x = person, y = values)) + geom_bar(stat = "identity", aes(fill = category)) ``` ] <img class="img-234" src="assets/color.png" alt="example stacked bar plot with values in different colors, making it hard to distinguish between categories"/> --- class: hide-count background-color: white background-image: url('assets/slide234.jpeg') background-size: contain <div class="title-234"> 1. Don't rely on color to explain the data </div> <a class="large-link" href="https://www.color-blindness.com/coblis-color-blindness-simulator/">Coblis — Color Blindness Simulator</a> <img class="img-234" style="width:30%;" src="assets/coblis.png" alt="screenshots of the previous stacked plot simulating various types of color blindness"/> --- class: hide-count background-color: white background-image: url('assets/slide234.jpeg') background-size: contain <div class="title-234"> 1. Don't rely on color to explain the data </div> .custom-code-css[ ```r library(ggpattern) ggplot(data, aes(x = person, y = values)) + geom_col_pattern( aes(pattern = category), fill = 'white', colour = 'black', ) ``` ] <img class="img-234" src="assets/pattern.png" style="top:140px;left:660px;" alt="the same stacked bar plot, but rather than using colors to differentiate groups, one category is hashed lines, the other diagonal lines, and the last category repeating plus signs"/> --- class: hide-count background-color: white background-image: url('assets/slide5.jpeg') background-size: contain <div class="title-234 white"> 2. Don't use very bright or low-contrast colors </div> .custom-code-2[ ```r colorchecker::contrast_checker() ``` ]
Color Contrast Checker
Large Text
WCAG AA
Normal Text
WCAG AA
Large Text
WCAG AAA
Large Text
WCAG AAA
Click to change the demo text
Foreground
R
G
B
Background
R
G
B
--- class: hide-count background-color: white background-image: url('assets/slide6.jpeg') background-size: contain <div class="title-234 white"> 3. Don't hide important data behind interactions </div> .plotly-hover[
] .focus-plot[
] <div id='plotly-output'></div> --- class: hide-count background-color: white background-image: url('assets/slide6.jpeg') background-size: contain <div class="title-234 white"> 3. Don't hide important data behind interactions </div> .plotly-hover-code[ ```r plotly::plot_ly( data, x = ~person, y = ~values, type = 'bar', color = ~category, hovertemplate = paste( '<b> Value:</b>%{y}', '<extra></extra>') ) %>% plotly::layout(barmode = 'stack') ``` ] .plotly-focus-code[ ```r tags$div(id="plotly-output") plotly::plot_ly( data, x = ~person, y = ~values, type = 'bar', color = ~category, hoverinfo='none' ) %>% plotly::layout(barmode = 'stack') %>% htmlwidgets::onRender(" function(el) { el.on('plotly_click', function(d) { let output = document.getElementById('plotly-output') output.innerHTML = `Value: ${d.points[0].value}` }); } ") ``` ] --- class: hide-count background-color: white background-image: url('assets/slide7.jpeg') background-size: contain <div class="title-234"> 4. Don't overwhelm the user with information </div> <div class="slide-header">The goal of a data science team is to help organizations or individuals make better decisions informed by data <br><span style="text-align:right;">-Sean Lopp</span></div> <div class="item-1">Decide what users need</div> <div class="item-2">Lead with key data</div> <div class="item-3">Hand power to the user</div> <div class="item-4">Use consistent language and colors</div> --- class: hide-count background-color: white background-image: url('assets/slide8.jpeg') background-size: contain <div class="title-234"> 5. Use accessibility tools when designing </div> <a class="a-slide-title" href="https://www.w3.org/TR/WCAG21/">Web Content Accessibility Guidelines</a> <a class="a-list-1" href="https://color.a11y.com/">Color Contrast Validator</a> <a class="a-list-2" href="https://developers.google.com/web/tools/lighthouse">Google Lighthouse</a> <a class="a-list-3" href="https://www.a11yproject.com/checklist/">A11y Project Checklist</a> --- class: hide-count background-color: white background-image: url('assets/slide234.jpeg') background-size: contain <div class="title-234"> 6. Use patterns and shapes in addition to color </div> .custom-code-css[ ```r ggplot(data, aes(x = values, y = values2)) + geom_point(stat = "identity", aes( color = category ) ) ``` ] <img class="img-234" src="assets/points_color.png" style="width:30%;top: 200px;" alt="an example dot plot with random values plotted on both the x and y axis, colored by one of three possible categories."/> --- class: hide-count background-color: white background-image: url('assets/slide234.jpeg') background-size: contain <div class="title-234"> 6. Use patterns and shapes in addition to color </div> .custom-code-css[ ```r ggplot(data, aes(x = values, y = values2)) + geom_point(stat = "identity", aes( color = category, shape = category ) ) ``` ] <img class="img-234" src="assets/point_shape.png" style="width:30%;top:200px;" alt="the same dot plot as the slide before, but rather than denote group only by color, the groups are also distinguished by shape."/> --- class: hide-count background-color: white background-image: url('assets/slide234.jpeg') background-size: contain <div class="title-234"> 7. Use labels and legends </div> .custom-code-css-grob[ ```r p <- ggplot(data, aes(x = time, y = values, group = person)) + geom_point(aes(shape = person, color = person)) + geom_line(aes(color = person, linetype = person)) + geom_text(data = subset(data, time == 3), aes(label = person, colour = person, x = max(data$time) + 0.1, y = values ), hjust = -0.4) + theme(plot.margin = unit(c(1,6,1,1), "lines")) gt <- ggplotGrob(p) gt$layout$clip[gt$layout$name == "panel"] <- "off" grid.draw(gt) ``` ] <img class="img-234" src="assets/line_labels.png" style="width:30%;top:200px;" alt="A line plot of three peoples values over time where instead of using a legend box, the person identifier is aligned with the last value of the line on the y-axis."/> --- class: hide-count background-color: white background-image: url('assets/slide11.jpeg') background-size: contain <div class="title-11"> 8. Translate the data into clear language </div> <div class="white-background"></div> <iframe style="top: 140px;left: 250px;width: 650px;height: 400px;position: absolute;" src="https://observablehq.com/embed/@frankelavsky/chartability?cells=chart"></iframe> <a class="title-link link-11" href="https://chartability.fizz.studio/">Chartability</a> --- class: hide-count background-color: white background-image: url('assets/slide12.jpeg') background-size: contain <div class="title-234"> 9. Provide context and explain the visualization </div> <img src="assets/line-context.jpeg" class="line-context" alt="three time series lines where the lowest point is annotated as the low point at 2, and the high point is labeled as the record high at 15" /> .line-context-code[ ```r ggplot(data, aes(x = time, y = values, group = person) ) + geom_line(stat = "identity") + theme_bw() + annotate('text', x = 1.78, y = 2.2, label = "all time low") + annotate('text', x = 3.14, y = 15, label = "record high") + xlim(1,3.5) ``` ] --- class: hide-count background-color: white background-image: url('assets/slide12.jpeg') background-size: contain <div class="title-234"> 9. Provide context and explain the visualization </div> <img src="assets/bar-context.png" class='bar-context' alt="three stacked bar plots where the last plot has a highlighted section in maroon with the annotation some event worth highlighting'" /> .bar-context-code[ ```r ggplot(data, aes(x = person, y = values)) + geom_bar( stat = 'identity', aes(fill = test), color = "white", size = 1 ) + scale_fill_manual( values = c("lightgray", "maroon")) + scale_x_discrete( limits = c("Person 1", "Person 2", "Person 3", "") ) + annotate('text', x = 3.8, y = 13, label = "Some event worth highlighting", color = "maroon") ``` ] --- class: hide-count background-color: white background-image: url('assets/slide13.jpeg') background-size: contain <div class="title-234 white"> 10. Focus on accessibility during user interviews </div> .box-13[ ## Preparing - Give user personas disabilities ] <img class='img-13' src="assets/interview1.jpeg" alt="crowd of people"/> --- class: hide-count background-color: white background-image: url('assets/slide13.jpeg') background-size: contain <div class="title-234 white"> 10. Focus on accessibility during user interviews </div> .box-13[ <h2>Recruiting</h2> - Set aside 1 on 1 time - Give participants a ride share credit - Inquire about the assistive technology used ] <img class='img-13' src="assets/interview2.jpeg" alt="zoom in of an interview with a hand taking notes in a notebook"/> --- class: hide-count background-color: white background-image: url('assets/slide13.jpeg') background-size: contain <div class="title-234 white "> 10. Focus on accessibility during user interviews </div> .box-13[ ## Conducting - Bring their own hardware - Assistive Tech specialist on sight - Assume interviews will be longer - Have a working prototype ] <img class='img-13' src="assets/interview3.jpeg" alt="zoom in of an interview with a hand taking notes in a notebook"/> --- class: hide-count background-color: white background-image: url('assets/thankyou.jpeg') background-size: contain