Notebook Customizability¶

Customizability of notebook experiences could have accessibility implications. In this Jupyter notebook we analyze the impacts of customizability of notebooks using themes, and further analyze the various error and warning reports obtained from running accessibility scans on HTML exports of the notebooks during the execution of the pipeline.

This notebook attempts to reproduce the results in Figure 6 and Figure 7 respectively. Specifically:

  • 6(b): CDF of accessibility warnings and errors based on the theme.

Required libraries:¶

  • collections
  • matplotlib
  • numpy
  • pandas
In [1]:
from collections import defaultdict
from helper.cdf import cdf

import matplotlib
from matplotlib.lines import Line2D
import matplotlib.pyplot as plt

import numpy
import pandas


matplotlib.rcParams.update({'font.size': 20, 'pdf.fonttype': 42, 'ps.fonttype': 42})
In [2]:
df = pandas.read_csv('data_out/a11y-aggregate-scan.csv')
df
Out[2]:
ID Notebook Theme Standard Date Total Errors Warnings Notices
0 abef44ae06db4204313800369b7f974349978351cd9c77... f22a8028b9fd08cce576531c004f250b08852c58.ipynb dark WCAG2AA NaN 149 75 43 31
1 010c9497f00c20c62f278456327bb9e3933c4fcef5c6b7... 0b06f98da97edb472f2fc1995dab235c4063a89e.ipynb dark WCAG2AA NaN 356 253 69 34
2 8662195164e1ba0cf34dc5fa7a22306c883229e99f6efa... 02ad60c3d2e7a492f98d1f4570a4edf693fa0c46.ipynb dark WCAG2AA NaN 570 363 161 46
3 db617cb33c8a99dc4528f2ad1d9639f629976b834b24e2... 195b6cb332678c68d81e4cebbe9f49af20616872.ipynb dark WCAG2AA NaN 1316 431 843 42
4 3c70174e0a705ab004f765a7f132db59e87855156bc93b... f8ddb93b77a299a2b2b0ffb6bbc48ca8b41c22e7.ipynb dark WCAG2AA NaN 458 388 40 30
... ... ... ... ... ... ... ... ... ...
571480 cbf700a9e7adb07c63509336565d97baa3ab131f1d5877... 7f1af1aec4790810b1656b792fdbf1a35d74c3f1.ipynb solarized WCAG2AA NaN 191 47 112 32
571481 0d5fb307d2bddb9138631a277a73069283daab8597c8d6... 06a07d156ce1f4938f7686d8dc34db0a3edb0747.ipynb solarized WCAG2AA NaN 165 100 41 24
571482 fb50be8bcc0aec1cf0267f2289f82bb22b064e4827052a... d0307e287404077e2df7ae07f9052953fef6bc08.ipynb solarized WCAG2AA NaN 1871 1070 523 278
571483 8d26756916c30f603b86316d838e4090efb81fc28096d8... 2f0fc2db70f8c6b5269590fa8e3fdce7f6baa0f3.ipynb solarized WCAG2AA NaN 83 34 21 28
571484 d79a0eed8ba6c86b750869e10c5bfb239717ac2f3c8313... 6481cdb6181677574756fb834815c569ea2d29e1.ipynb solarized WCAG2AA NaN 472 284 164 24

571485 rows × 9 columns

Figure 6(b): CDF of Accessibility Warnings and Errors Based on Theme¶

In [3]:
fig_description = """Figure 6(b) indicates the CDF of the accessibility warnings and errors reported by axe and
htmlcs on various themes in our experiments. The figure contains a total of 12 colored lines, using 6 distinct 
colors and two line styles. The solid lines represent the distribtion of errors per theme, and the dashed 
line represents the number of warnings per theme. The solid blue and red lines indicating darcula and 
light are to the extreme right side of the lines in the figure indicating the most number of accessibility 
errors compared to other themes, the best performing theme is indicated by the green solid line representing 
horizon theme which indicates an 85% improvement over the darcula and light themes. Other themes in our 
study lie between these two lines whose medians are at 31 and 160 respectively. The x axis is represented 
by a log scale indicator of the number of warnings / errors related to accessibility and the y axis indicates 
the CDF ranging from 0-1.
"""
In [4]:
def plot_aggregate_errors_and_warnings(df):
    error_results = defaultdict(list)
    warning_results = defaultdict(list)
    for index, row in df.iterrows():
        theme = row['Theme']
        error_count = row['Errors']
        warning_count = row['Warnings']
        error_results[theme].append(error_count)
        warning_results[theme].append(warning_count)

    plot_line_style = {
        'warning': '--',
        'error': '-',
    }
    theme_style = {
        'darcula': '#1f77b4',
        'dark': '#ff7f0e',
        'horizon': '#2ca02c',
        'light': '#d62728',
        'material-darker': '#9467bd',
        'solarized': '#8c564b',
    }
    
    fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(10, 8))
    for plot_type, result_dict in [('error', error_results), ('warning', warning_results)]:
        for theme, arr in result_dict.items():
            theme_color = theme_style[theme]
            line_style = plot_line_style[plot_type]
            X, Y = cdf(arr, sort_needed=True)
            for p in [25, 50, 75, 90, 95, 99]:
                print(f'[{plot_type}] [{theme}] [P={p}] {numpy.percentile(X, p)}')
            ax.plot(X, Y, label=f'{theme}', linestyle=line_style, linewidth=2, color=theme_color)
    ax.set_xlabel('Number of Warnings / Errors related to Accessibility', fontsize=18)
    ax.set_ylabel('CDF of warnings/errors', fontsize=18)
    ax.set_xscale('log')
    line_labels = [k for k, c in theme_style.items()]
    custom_lines = [Line2D([0], [0], color=c, linewidth=4) for k, c in theme_style.items()]
    agg_label_lines = [Line2D([1], [1], linestyle=l, color='black', linewidth=4) for k, l in plot_line_style.items()]
    agg_labels = [k for k, c in plot_line_style.items()]
    l1 = ax.legend(custom_lines, line_labels, loc=2, fancybox=True, fontsize='small')
    l2 = ax.legend(agg_label_lines, agg_labels, loc=4, fontsize='large')

    ax.add_artist(l1)
    ax.add_artist(l2)
    plt.savefig('plot_out/fig-6b-warnings_errors.pdf', bbox_inches='tight')
    plt.savefig('plot_out/alt-embedded-images/fig-6b-warnings_errors.png',
                metadata={'alt': fig_description},
                bbox_inches='tight')
    

plot_aggregate_errors_and_warnings(df)
[error] [dark] [P=25] 52.0
[error] [dark] [P=50] 129.0
[error] [dark] [P=75] 281.0
[error] [dark] [P=90] 503.0
[error] [dark] [P=95] 696.0999999999913
[error] [dark] [P=99] 1226.0
[error] [light] [P=25] 87.0
[error] [light] [P=50] 206.0
[error] [light] [P=75] 438.0
[error] [light] [P=90] 781.0
[error] [light] [P=95] 1089.0
[error] [light] [P=99] 1929.0
[error] [material-darker] [P=25] 33.0
[error] [material-darker] [P=50] 70.0
[error] [material-darker] [P=75] 140.0
[error] [material-darker] [P=90] 248.0
[error] [material-darker] [P=95] 341.0
[error] [material-darker] [P=99] 623.0899999999965
[error] [horizon] [P=25] 11.0
[error] [horizon] [P=50] 31.0
[error] [horizon] [P=75] 77.0
[error] [horizon] [P=90] 162.0
[error] [horizon] [P=95] 239.0
[error] [horizon] [P=99] 510.31999999999243
[error] [darcula] [P=25] 88.0
[error] [darcula] [P=50] 205.0
[error] [darcula] [P=75] 427.0
[error] [darcula] [P=90] 768.0
[error] [darcula] [P=95] 1067.550000000003
[error] [darcula] [P=99] 1928.9100000000035
[error] [solarized] [P=25] 36.0
[error] [solarized] [P=50] 90.0
[error] [solarized] [P=75] 203.0
[error] [solarized] [P=90] 380.0
[error] [solarized] [P=95] 551.0
[error] [solarized] [P=99] 1043.0
[warning] [dark] [P=25] 31.0
[warning] [dark] [P=50] 82.0
[warning] [dark] [P=75] 255.0
[warning] [dark] [P=90] 665.0
[warning] [dark] [P=95] 1142.0999999999913
[warning] [dark] [P=99] 2636.220000000001
[warning] [light] [P=25] 39.0
[warning] [light] [P=50] 105.0
[warning] [light] [P=75] 307.0
[warning] [light] [P=90] 800.0
[warning] [light] [P=95] 1317.0
[warning] [light] [P=99] 2912.0
[warning] [material-darker] [P=25] 29.0
[warning] [material-darker] [P=50] 60.0
[warning] [material-darker] [P=75] 127.0
[warning] [material-darker] [P=90] 264.0
[warning] [material-darker] [P=95] 410.0
[warning] [material-darker] [P=99] 982.0
[warning] [horizon] [P=25] 27.0
[warning] [horizon] [P=50] 55.0
[warning] [horizon] [P=75] 112.0
[warning] [horizon] [P=90] 224.0
[warning] [horizon] [P=95] 357.0
[warning] [horizon] [P=99] 912.6399999999849
[warning] [darcula] [P=25] 29.0
[warning] [darcula] [P=50] 61.0
[warning] [darcula] [P=75] 128.0
[warning] [darcula] [P=90] 267.0
[warning] [darcula] [P=95] 416.0
[warning] [darcula] [P=99] 998.0
[warning] [solarized] [P=25] 29.0
[warning] [solarized] [P=50] 61.0
[warning] [solarized] [P=75] 128.0
[warning] [solarized] [P=90] 267.0
[warning] [solarized] [P=95] 416.0
[warning] [solarized] [P=99] 991.039999999979
No description has been provided for this image

Figure 6(b) indicates the CDF of the accessibility warnings and errors reported by axe and htmlcs on various themes in our experiments. The figure contains a total of 12 colored lines, using 6 distinct colors and two line styles. The solid lines represent the distribtion of errors per theme, and the dashed line represents the number of warnings per theme. The solid blue and red lines indicating darcula and light are to the extreme right side of the lines in the figure indicating the most number of accessibility errors compared to other themes, the best performing theme is indicated by the green solid line representing horizon theme which indicates an 85% improvement over the darcula and light themes. Other themes in our study lie between these two lines whose medians are at 31 and 160 respectively. The x axis is represented by a log scale indicator of the number of warnings / errors related to accessibility and the y axis indicates the CDF ranging from 0-1.