Skip to content

nonvisual data frames and heat mapsยค

in this stream, tony is visited by khalid to talk about representing information in nonvisual ways. i met khalid during the nonvisual data science course taught be the iota school. in this class, he was talking about his challenges in producing and interpretting a heatmap. since then, i've been thinking about how to do better. this stream is our first meeting where we acheive our goals of designing better nonvisual/visual heatmaps.

since, we've been coordinating community on the blindcoders mailing list.

%%
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="" frameborder="0" height="315" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/uF9VpP-mrSE?si=henKrAC5fY7AxLTR" title="YouTube video player" width="560"></iframe>
/home/tbone/mambaforge/envs/p311/lib/python3.11/site-packages/IPython/core/display.py:431: UserWarning: Consider using IPython.display.IFrame instead
  warnings.warn("Consider using IPython.display.IFrame instead")
  1. we start by understanding the experience of a blind data scientist navigating post graduate work. we learn about the challenges associated with AI and notebooks.
  2. we understand the need for better nonvisual dataframes for equitable data science experiences for BVI students.
  3. we iterate on table representations with khalid providing feedback about the screen reader experience while we practice communicating nonvisual data science topics. we consider the utility of tables and dataframes in exploring data.
  4. finally, we make a visual and nonvisual dataframe representations out of tables and css. this approach provides automony to BVI data scientists allowing them to experience the data themselves.
%%
## ai interpretting visualizations

<dl><dt>

[2:57](https://www.youtube.com/live/uF9VpP-mrSE?t=177s)
</dt><dd>

Khalid describes intpretting data using [be my eyes](https://www.bemyeyes.com/), [be my ai](https://www.bemyeyes.com/blog/introducing-be-my-ai), [JAWS picture](https://blog.freedomscientific.com/picture-smart-in-jaws-independently-selecting-your-artwork/), openai, and claude. eventually he had to rely on a person to support him. data literacy among

</dd></dl>

ai interpretting visualizations

2:57

Khalid describes intpretting data using be my eyes, be my ai, JAWS picture, openai, and claude. eventually he had to rely on a person to support him. data literacy among

example heatmap of the correlation matrixยค

    Image(
        "corrs/corr_cryptos/Correlation Matrix of Cryptocurrencies (2022-04-01 to 2024-03-31).png"
    )
No description has been provided for this image

a list of the files khalid generated for his homework

    ls corrs/corr_cryptos/
'ADA-USD vs. ALGO-USD (Positive Correlation).png'
'ADA-USD vs. BAT-USD (Positive Correlation).png'
'ADA-USD vs. DASH-USD (Positive Correlation).png'
'ADA-USD vs. OMG-USD (Positive Correlation).png'
'ADA-USD vs. TRX-USD (Negative Correlation).png'
'ADA-USD vs. UNI-USD (Negative Correlation).png'
'ADA-USD vs. XMR-USD (Negative Correlation).png'
'ADA-USD vs. ZEC-USD (Negative Correlation).png'
'BTC-USD vs. BCH-USD (Positive Correlation).png'
'BTC-USD vs. DCR-USD (Negative Correlation).png'
'BTC-USD vs. FTM-USD (Positive Correlation).png'
'BTC-USD vs. ICX-USD (Positive Correlation).png'
'BTC-USD vs. TON-USD (Positive Correlation).png'
'BTC-USD vs. TRX-USD (Negative Correlation).png'
'BTC-USD vs. UNI-USD (Negative Correlation).png'
'BTC-USD vs. ZEC-USD (Negative Correlation).png'
'Correlation Matrix of Cryptocurrencies (2022-04-01 to 2024-03-31).png'
'LTC-USD vs. ATOM-USD (Positive Correlation).png'
'LTC-USD vs. DOGE-USD (Positive Correlation).png'
'LTC-USD vs. ETC-USD (Positive Correlation).png'
'LTC-USD vs. MANA-USD (Negative Correlation).png'
'LTC-USD vs. TRX-USD (Negative Correlation).png'
'LTC-USD vs. UNI-USD (Negative Correlation).png'
'LTC-USD vs. XRP-USD (Positive Correlation).png'
'LTC-USD vs. ZEC-USD (Negative Correlation).png'
'Top Correlations with ADA-USD (2022-04-01 to 2024-03-31).png'
'Top Correlations with BTC-USD (2022-04-01 to 2024-03-31).png'
'Top Correlations with LTC-USD (2022-04-01 to 2024-03-31).png'
'Top Correlations with XRP-USD (2022-04-01 to 2024-03-31).png'
'XRP-USD vs. BNB-USD (Positive Correlation).png'
'XRP-USD vs. DCR-USD (Negative Correlation).png'
'XRP-USD vs. DOGE-USD (Positive Correlation).png'
'XRP-USD vs. ETC-USD (Positive Correlation).png'
'XRP-USD vs. ETH-USD (Positive Correlation).png'
'XRP-USD vs. TRX-USD (Negative Correlation).png'
'XRP-USD vs. UNI-USD (Negative Correlation).png'
'XRP-USD vs. ZEC-USD (Negative Correlation).png'
    from nbconvert_a11y.t import get_table
    from nbconvert_a11y.t import Config, CssVarGrouping
    show = compose_left(get_table, str, HTML)
%%
loading the correlated crypto data

    df = pandas.read_csv(
        "crypto_data_correlation_2022-04-01_to_2024-03-31_normalised.csv"
    ).set_index("Date")
    df.columns = df.columns.str.rstrip("-USD")
    df.pipe(show, caption="a subset of the crypto time series from 2022 to 2024")
a subset of the crypto time series from 2022 to 2024
DateETHXLMBCHDASHNEO...MANAAGIXTONAAVEMKR
2022-04-010.800.970.540.951.00...0.970.090.951.000.55
2022-04-020.800.980.530.950.98...0.970.091.000.960.53
2022-04-030.821.000.541.001.00...1.000.100.940.990.55
2022-04-040.820.970.541.000.96...0.970.100.870.960.59
2022-04-050.790.930.520.950.90...0.930.090.850.880.55
2022-04-060.710.800.450.820.75...0.840.080.730.720.48
2022-04-070.730.850.460.850.78...0.880.090.770.780.48
2022-04-080.720.790.440.790.72...0.810.080.720.680.47
2022-04-090.740.810.440.830.75...0.840.080.730.690.49
2022-04-100.720.790.430.800.71...0.820.090.720.650.47
............
2024-03-210.810.370.610.100.40...0.150.740.400.380.89
2024-03-220.760.340.640.090.38...0.140.720.410.350.81
2024-03-230.760.370.690.100.39...0.150.740.390.370.78
2024-03-240.800.380.740.110.42...0.160.800.420.380.82
2024-03-250.850.400.750.120.44...0.160.840.480.400.86
2024-03-260.840.400.730.130.46...0.170.850.480.420.84
2024-03-270.820.380.850.120.44...0.160.930.440.390.86
2024-03-280.840.400.900.130.46...0.171.000.460.400.96
2024-03-290.820.431.000.140.49...0.170.940.460.400.97
2024-03-300.820.410.950.130.46...0.160.940.450.381.00
count730.00730.00730.00730.00730.00...730.00730.00730.00730.00730.00
mean0.290.260.180.180.20...0.200.150.150.200.18
std0.190.160.160.170.16...0.160.160.170.160.14
min0.000.000.000.000.00...0.000.000.000.000.00
25%0.180.130.050.070.10...0.100.050.010.090.08
50%0.260.250.100.160.16...0.160.110.110.170.15
75%0.340.320.280.240.27...0.270.190.200.270.23
max1.001.001.001.001.00...1.001.001.001.001.00

loading the correlated crypto data

df = pandas.read_csv(
    "crypto_data_correlation_2022-04-01_to_2024-03-31_normalised.csv"
).set_index("Date")
df.columns = df.columns.str.rstrip("-USD")
df.pipe(show, caption="a subset of the crypto time series from 2022 to 2024")
    table_config = Config(
        data_visibility=Config.DataVisibility(max_rows=1000, max_cols=1000,), 
        css=Config.Css(var_grouping=CssVarGrouping.cell),
        summary_footer=False
    )
%%
nonvisual representation of the pearson correlation coefficient of the currencies.

    df.corr().pipe(
        compose_left(show, display), config=table_config,
        id="crypto", caption="correlation matrix of crypto cyrrencies. \
        each element is the pearson correlation coefficient for the currency in the row and column"
    )

visual styling to make the table appear as a heatmap. this needs more design, but the gist is there.

```html
<style>
#crypto {
    td {
        background-color: rgba(
            calc(var(--val) * 255), calc(var(--val) * 255), calc(var(--val) * 255), 1
        );
        font-size: 0px;
        &:hover {
            font-size: 1em;
        }
    }
}
</style>
```
correlation matrix of crypto cyrrencies. each element is the pearson correlation coefficient for the currency in the row and column
index 1ETHXLMBCHDASHNEODOGEBNBTRXEOWAVEQTUMSCBATDCRETCZECXTZOMGXMRATOMAVAXLINKALGODOTUNIICXFTMFILSANMANAAGIXTONAAVEMKR
ETH1.000.630.870.230.820.780.760.710.320.410.720.850.400.360.540.210.380.230.390.460.810.840.300.63-0.060.570.780.640.330.390.700.770.760.84
XLM0.631.000.670.450.730.530.370.280.560.740.800.590.710.640.510.640.690.590.630.550.750.490.620.78-0.010.800.640.770.680.700.080.790.790.60
BCH0.870.671.000.030.640.690.550.730.110.310.580.700.260.210.350.100.220.070.330.240.650.780.140.46-0.060.420.610.480.180.230.630.620.630.89
DASH0.230.450.031.000.640.450.45-0.400.910.800.740.280.850.870.500.870.840.920.670.850.60-0.010.850.80-0.010.830.710.830.880.88-0.090.640.65-0.03
NEO0.820.730.640.641.000.730.710.360.680.730.930.790.750.670.640.580.720.640.610.740.910.680.650.87-0.040.850.910.880.690.740.430.950.920.61
DOGE0.780.530.690.450.731.000.850.340.500.470.710.640.520.540.520.380.500.430.400.600.770.630.510.68-0.060.590.820.690.460.500.590.710.730.64
BNB0.760.370.550.450.710.851.000.320.530.400.690.670.500.540.650.330.510.430.260.610.730.580.490.64-0.020.530.810.650.430.480.660.660.670.60
TRX0.710.280.73-0.400.360.340.321.00-0.31-0.130.200.66-0.15-0.240.13-0.35-0.17-0.35-0.07-0.170.360.84-0.260.06-0.05-0.010.220.04-0.25-0.190.650.340.300.79
EO0.320.560.110.910.680.500.53-0.311.000.830.820.370.920.950.720.910.930.950.640.890.690.100.930.870.010.870.700.880.930.92-0.110.720.740.09
WAVE0.410.740.310.800.730.470.40-0.130.831.000.840.480.910.850.580.880.890.880.640.800.760.240.870.89-0.010.920.740.900.920.92-0.140.790.810.29
QTUM0.720.800.580.740.930.710.690.200.820.841.000.700.900.850.750.770.880.810.670.790.900.530.820.95-0.030.930.880.960.850.880.240.950.950.55
SC0.850.590.700.280.790.640.670.660.370.480.701.000.500.420.570.300.480.340.310.470.850.850.420.68-0.040.580.700.660.420.470.490.790.760.80
BAT0.400.710.260.850.750.520.50-0.150.920.910.900.501.000.950.690.930.980.950.610.810.780.240.950.94-0.010.930.740.930.980.98-0.100.830.820.28
DCR0.360.640.210.870.670.540.54-0.240.950.850.850.420.951.000.680.950.960.960.650.830.730.150.960.910.020.890.700.900.950.95-0.130.750.770.20
ETC0.540.510.350.500.640.520.650.130.720.580.750.570.690.681.000.550.710.620.380.710.680.450.650.710.000.610.610.710.630.660.170.670.740.40
ZEC0.210.640.100.870.580.380.33-0.350.910.880.770.300.930.950.551.000.950.970.670.760.630.010.950.860.010.880.590.840.970.95-0.320.680.690.08
XTZ0.380.690.220.840.720.500.51-0.170.930.890.880.480.980.960.710.951.000.970.610.810.750.210.970.930.010.910.700.910.980.98-0.130.800.800.25
OMG0.230.590.070.920.640.430.43-0.350.950.880.810.340.950.960.620.970.971.000.620.820.660.050.970.880.010.880.650.870.970.96-0.220.710.710.08
XMR0.390.630.330.670.610.400.26-0.070.640.640.670.310.610.650.380.670.610.621.000.660.580.190.580.67-0.040.730.600.680.660.66-0.100.630.700.17
ATOM0.460.550.240.850.740.600.61-0.170.890.800.790.470.810.830.710.760.810.820.661.000.750.280.830.840.010.820.800.870.820.840.060.730.800.19
AVAX0.810.750.650.600.910.770.730.360.690.760.900.850.780.730.680.630.750.660.580.751.000.710.730.92-0.030.840.900.900.740.770.320.930.930.69
LINK0.840.490.78-0.010.680.630.580.840.100.240.530.850.240.150.450.010.210.050.190.280.711.000.160.45-0.040.350.560.430.140.200.600.660.650.86
ALGO0.300.620.140.850.650.510.49-0.260.930.870.820.420.950.960.650.950.970.970.580.830.730.161.000.910.030.870.660.880.960.95-0.180.740.750.18
DOT0.630.780.460.800.870.680.640.060.870.890.950.680.940.910.710.860.930.880.670.840.920.450.911.00-0.020.950.860.980.920.940.090.910.910.46
UNI-0.06-0.01-0.06-0.01-0.04-0.06-0.02-0.050.01-0.01-0.03-0.04-0.010.020.000.010.010.01-0.040.01-0.03-0.040.03-0.021.00-0.03-0.05-0.02-0.00-0.01-0.05-0.03-0.00-0.02
ICX0.570.800.420.830.850.590.53-0.010.870.920.930.580.930.890.610.880.910.880.730.820.840.350.870.95-0.031.000.830.960.930.940.020.900.880.37
FTM0.780.640.610.710.910.820.810.220.700.740.880.700.740.700.610.590.700.650.600.800.900.560.660.86-0.050.831.000.880.700.750.470.870.870.57
FIL0.640.770.480.830.880.690.650.040.880.900.960.660.930.900.710.840.910.870.680.870.900.430.880.98-0.020.960.881.000.910.930.140.910.910.45
SAN0.330.680.180.880.690.460.43-0.250.930.920.850.420.980.950.630.970.980.970.660.820.740.140.960.92-0.000.930.700.911.000.99-0.200.770.780.18
MANA0.390.700.230.880.740.500.48-0.190.920.920.880.470.980.950.660.950.980.960.660.840.770.200.950.94-0.010.940.750.930.991.00-0.120.810.810.23
AGIX0.700.080.63-0.090.430.590.660.65-0.11-0.140.240.49-0.10-0.130.17-0.32-0.13-0.22-0.100.060.320.60-0.180.09-0.050.020.470.14-0.20-0.121.000.300.260.60
TON0.770.790.620.640.950.710.660.340.720.790.950.790.830.750.670.680.800.710.630.730.930.660.740.91-0.030.900.870.910.770.810.301.000.950.63
AAVE0.760.790.630.650.920.730.670.300.740.810.950.760.820.770.740.690.800.710.700.800.930.650.750.91-0.000.880.870.910.780.810.260.951.000.63
MKR0.840.600.89-0.030.610.640.600.790.090.290.550.800.280.200.400.080.250.080.170.190.690.860.180.46-0.020.370.570.450.180.230.600.630.631.00

nonvisual representation of the pearson correlation coefficient of the currencies.

df.corr().pipe(
    compose_left(show, display), config=table_config,
    id="crypto", caption="correlation matrix of crypto cyrrencies. \
    each element is the pearson correlation coefficient for the currency in the row and column"
)

visual styling to make the table appear as a heatmap. this needs more design, but the gist is there.

<style>
#crypto {
    td {
        background-color: rgba(
            calc(var(--val) * 255), calc(var(--val) * 255), calc(var(--val) * 255), 1
        );
        font-size: 0px;
        &:hover {
            font-size: 1em;
        }
    }
}
</style>
%%
## audible, visual and tactile dataframe accessibility

<dl>
<dt>

[45:00](https://www.youtube.com/live/uF9VpP-mrSE?t=2700s)

 </dt><dd>

&gt;  Tables are not pictures of data: they are catalogues of data to be perused, parsed, referenced and interrogated. A well-designed table will enable the information to be read and understood, and will reveal the patterns and correlations inherent in the data.
&gt;&gt; * https://alistapart.com/article/web-typography-tables/
</dd>
</dl>

### useful links about accessible table and type design

* https://racheleditullio.com/blog/2020/03/5-ways-to-improve-table-accessibility/
* https://adrianroselli.com/2017/11/a-responsive-accessible-table.html
* https://adrianroselli.com/2017/11/hey-its-still-ok-to-use-tables.html
* https://readings.design/PDF/ThePrinciplesoftheNewTypography.pdf
* https://tonyfast.github.io/tonyfast/draft/tonyfast/tonyfast/tonyfast/xxiv/2024-02-20-multiindex-html.html
* https://www.highcharts.com/docs/accessibility/patterns-and-contrast
* https://github.com/Chartability/POUR-CAF

audible, visual and tactile dataframe accessibility

45:00

Tables are not pictures of data: they are catalogues of data to be perused, parsed, referenced and interrogated. A well-designed table will enable the information to be read and understood, and will reveal the patterns and correlations inherent in the data.

useful links about accessible table and type design