Skip to content

Commit b7a6033

Browse files
Merge pull request #7 from data-6-berkeley/a11y-fixes
Accessibility Fixes
2 parents aec0ab8 + 9e0ad17 commit b7a6033

File tree

18 files changed

+138
-26
lines changed

18 files changed

+138
-26
lines changed

01-intro/jupyter-notebook.qmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ In order to run computer programs, we need a way to execute code written in a pr
2525
The environment we will use is **Jupyter Notebook**, which allows us to write and run code within a single `.ipynb` document (i.e., **notebook**). They also allow us to embedded text and code.
2626

2727
:::{style="text-align: center"}
28-
![An example of a Jupyter Notebook.](images/jupyter-oski.png){#fig-inflation fig-align=center width=90%}
28+
![An example of a Jupyter Notebook.](images/jupyter-oski.png){#fig-inflation fig-align=center width=90% fig-alt=""}
2929
:::
3030

3131
There's a lot going on in the above Jupyter Notebook screenshot: there is code, there is output from running code, there are pictures, and there is (non-code) text. We'll get to understanding all of these components in due time.
@@ -78,7 +78,7 @@ Jupyter Notebooks are made up of **cells**. There are two main types of cells:
7878
When run, Python code cells are evaluated as a Python code snippet, one line at a time. The cell output displayed is the value of the _last_ evaluated expression:
7979

8080
:::{style="text-align: center"}
81-
![Both expressions are evaluated, but the result of the last expression's evaluation is considered the output of the code cell.](images/jupyter-code-cell.png){#fig-inflation fig-align=center width=70%}
81+
![Both expressions are evaluated, but the result of the last expression's evaluation is considered the output of the code cell.](images/jupyter-code-cell.png){#fig-inflation fig-align=center width=70% fig-alt=""}
8282
:::
8383

8484
We will discuss this output/display phenomenon more in future notes.
@@ -88,7 +88,7 @@ To run a code cell, you can either hit the "Run" button in the Toolbar, or you c
8888
**Markdown cells.** This is where you write text and images that aren’t Python code. Markdown is a language used for formatting text. A Markdown cell will always display its formatting when it is not in edit mode.
8989

9090
:::{style="text-align: center"}
91-
![Left screenshot shows un-evaluated code cell and raw Markdown cell; right screenshot shows evaluated code cell and formatted text. To render formatted text for a selected markdown cell, exit editing mode for that cell. This screenshot starts with the code cell selected, then runs both that code cell and "runs" the markdown cell below.](images/jupyter-md-cell.png){#fig-inflation fig-align=center width=100%}
91+
![Left screenshot shows un-evaluated code cell and raw Markdown cell; right screenshot shows evaluated code cell and formatted text. To render formatted text for a selected markdown cell, exit editing mode for that cell. This screenshot starts with the code cell selected, then runs both that code cell and "runs" the markdown cell below.](images/jupyter-md-cell.png){#fig-inflation fig-align=center width=100% fig-alt=""}
9292
:::
9393

9494
Here is a [guide to Markdown formatting](https://www.markdownguide.org/cheat-sheet/). You’ll explore Markdown more in lab.

05-variables/index.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ It is challenging to use another person's data! The concepts have already been o
3030
For now, we focus on variables as they exist in tabular data. In most of the tabular datasets we will examine, variables correspond to **columns** of features. Each row is a **record** of a datapoint, with different values of variables measured for that datapoint.
3131

3232
:::{style="text-align: center"}
33-
![Variables as columns.](images/variable.png){#fig-inflation fig-align=center width=60%}
33+
![Variables as columns.](images/variable.png){#fig-inflation fig-align=center width=60% fig-alt=""}
3434
:::
3535

3636

@@ -49,7 +49,7 @@ Figure 2 has examples of each variable type.
4949

5050

5151
:::{style="text-align: center"}
52-
![Variable Types.](images/variable_types.png){#fig-inflation fig-align=center width=90%}
52+
![Variable Types.](images/variable_types.png){#fig-inflation fig-align=center width=90% fig-alt=""}
5353
:::
5454

5555
_What do we mean by "meaningful" arithmetic?_ From [Stat 20](https://www.stat20.org/1-questions-and-data/02-taxonomy-of-data/notes):

05-variables/units-of-analysis.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ Let's return to our American Community Survey (ACS) 2020 data. It shows educatio
5353
From the [ACS webpage](https://www.census.gov/programs-surveys/acs/methodology/design-and-methodology.html), the American Community Survey (ACS) is an ongoing monthly survey that collects detailed housing and socioeconomic data.
5454

5555
:::{style="text-align: center"}
56-
![ACS Household survey, which collects data on individual households.](images/acs_screenshot.png){#fig-inflation fig-align=center width=90%}
56+
![ACS Household survey, which collects data on individual households.](images/acs_screenshot.png){#fig-inflation fig-align=center width=90% fig-alt=""}
5757
:::
5858

5959
There are (at least) two datasets collected by the ACS: A private dataset of survey responses by household (Figure 1), and a public-facing dataset of responses by geographic region. The variables for the geographic region, a larger unit of analysis, are constructed via aggregation and estimation (Figure 2):
6060

6161
:::{style="text-align: center"}
62-
![ACS reported public data, which reports aggregated data of households across a geographic region.](images/acs_aggregate.png){#fig-inflation fig-align=center width=90%}
62+
![ACS reported public data, which reports aggregated data of households across a geographic region.](images/acs_aggregate.png){#fig-inflation fig-align=center width=90% fig-alt=""}
6363
:::
6464

6565
Simple forms of aggregation are straightforward and involve counting and averaging---methods that are very possible using our limited Data Science toolkit thus far. However, disaggregation cannot be done without individual datapoints! There are various methods of estimating individuals from averages using statistics and distributions; we discuss this briefly in a few weeks, but you can take a statistics course for more information.

06-variables-ii/sample-population.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The set of individuals we actually draw our sample from is the **sampling frame*
1616
## Examples
1717

1818
:::{style="text-align: center"}
19-
![A sampling frame may include individuals not in our population.](images/sampling-frame.png){#fig-inflation fig-align=center width=80%}
19+
![A sampling frame may include individuals not in our population.](images/sampling-frame.png){#fig-inflation fig-align=center width=80% fig-alt=""}
2020
:::
2121

2222
| Target Population | Collected sample |

07-visualizations/encoding.qmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Think of encoding as the bridge between your data and what people see on the scr
1616
In bar charts, **length** can visually encode a numerical variable.
1717

1818
:::{style="text-align: center"}
19-
![Bar Chart Example](images/barchart.png){#fig-barchart fig-align=center width=70%}
19+
![Bar Chart Example](images/barchart.png){#fig-barchart fig-align=center width=70% fig-alt=""}
2020
:::
2121

2222
This creates an intuitive mapping where the visual property (bar length) directly corresponds to the data value (average age).
@@ -27,7 +27,7 @@ This creates an intuitive mapping where the visual property (bar length) directl
2727
Other visualizations can include multiple variables encoded simultaneously.
2828

2929
:::{style="text-align: center"}
30-
![Multiple Encodings in a Scatter Plot](images/scatter.png){#fig-scatter fig-align=center width=80%}
30+
![Multiple Encodings in a Scatter Plot](images/scatter.png){#fig-scatter fig-align=center width=80% fig-alt=""}
3131
:::
3232

3333
### Quick Check: How Many Variables?
@@ -48,7 +48,7 @@ Look at the scatter plot above. How many different variables are being encoded?
4848
As we learned when studying variables, different variable types (numerical vs. categorical, discrete vs. continuous, ordinal vs. nominal) have different properties. When creating visualizations, we need to match our encoding choices to these variable types.
4949

5050
:::{style="text-align: center"}
51-
![Recall: Variable Types](images/variable_types.png){#fig-variable-types fig-align=center width=90%}
51+
![Recall: Variable Types](images/variable_types.png){#fig-variable-types fig-align=center width=90% fig-alt=""}
5252
:::
5353

5454
::: {.callout-important title="Key Principle"}
@@ -69,7 +69,7 @@ The table below summarizes which visual encodings work best for different types
6969
### What's Wrong with This?
7070

7171
:::{style="text-align: center"}
72-
![Problematic Car Manufacturer Chart](images/cars-graph.png){#fig-cars-graph fig-align=center width=70%}
72+
![Problematic Car Manufacturer Chart](images/cars-graph.png){#fig-cars-graph fig-align=center width=70% fig-alt=""}
7373
:::
7474

7575
**Problem**: This graph implies that Swedish cars are "greater" than cars from other countries in some sense, when they're not. If the variable is just "country of origin" (nominal categorical), using length encoding suggests an ordering that doesn't exist.

07-visualizations/index.qmd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To better understand these principles in action, let's examine how humans have u
2525
What do you see when you look at this ancient artifact?
2626

2727
:::{style="text-align: center"}
28-
![The World's First Map](images/world-map.jpg){#fig-ancient-map fig-align=center width=60%}
28+
![The World's First Map](images/world-map.jpg){#fig-ancient-map fig-align=center width=60% fig-alt=""}
2929
:::
3030

3131
This is a map depicting the town of Konya, Turkey - supposedly the world's first map, dating back to approximately 6200 BC. Even in prehistoric times, humans recognized the power of visual representation to communicate spatial relationships and important information.
@@ -47,7 +47,7 @@ One of the most famous examples of data visualization directly saving human live
4747
**The Solution**: Dr. John Snow was skeptical of the miasma theory and suspected contaminated water. He created a revolutionary approach that became standard in epidemiology: **he drew a map**.
4848

4949
:::{style="text-align: center"}
50-
![John Snow's Cholera Map](images/john-snow-cholera-map.png){#fig-cholera-map fig-align=center width=70%}
50+
![John Snow's Cholera Map](images/john-snow-cholera-map.png){#fig-cholera-map fig-align=center width=70% fig-alt=""}
5151
:::
5252

5353
**What the map revealed**:
@@ -64,7 +64,7 @@ One of the most famous examples of data visualization directly saving human live
6464
Florence Nightingale wasn't just a pioneering nurse, she was also an innovative data visualizer. During the Crimean War, she created what's now called a "rose diagram" or "coxcomb chart" to visualize the causes of death among British soldiers.
6565

6666
:::{style="text-align: center"}
67-
![Florence Nightingale's Rose Diagram](images/florence-nightingale-rose.png){#fig-rose-diagram fig-align=center width=60%}
67+
![Florence Nightingale's Rose Diagram](images/florence-nightingale-rose.png){#fig-rose-diagram fig-align=center width=60% fig-alt=""}
6868
:::
6969

7070
Her visualization revealed a shocking truth: more soldiers were dying from preventable diseases than from battle wounds. This wasn't just a pretty chart, it was a powerful argument that drove major reforms in military medical care. Nightingale understood that abstract statistics about mortality rates couldn't compete with the visual impact of her rose petals, where the size of each segment made the disparity impossible to ignore.
@@ -76,7 +76,7 @@ Her visualization revealed a shocking truth: more soldiers were dying from preve
7676
Not all data visualization involves charts and graphs. Maya Lin's Vietnam War Memorial in Washington DC proves that data can be deeply emotional and memorial, not just analytical.
7777

7878
:::{style="text-align: center"}
79-
![Vietnam War Memorial](images/veitnam-war-memorial.png){#fig-vietnam-memorial fig-align=center width=70%}
79+
![Vietnam War Memorial](images/veitnam-war-memorial.png){#fig-vietnam-memorial fig-align=center width=70% fig-alt=""}
8080
:::
8181

8282
Each of the 58,000+ names etched into the black granite represents one life lost. The chronological arrangement tells the story of the war's progression through time, while the reflective surface creates an intimate connection between viewers and the data you literally see yourself reflected among the names. This memorial demonstrates that the most powerful visualizations don't just inform us; they transform how we feel about the information.
@@ -86,7 +86,7 @@ Each of the 58,000+ names etched into the black granite represents one life lost
8686
During the COVID-19 pandemic, data visualization became part of daily life. Suddenly, everyone from epidemiologists to elementary school students was reading line charts showing case trends and interpreting what those curves meant for their communities.
8787

8888
:::{style="text-align: center"}
89-
![COVID-19 Case Tracking](images/coivd.png){#fig-covid-dashboard fig-align=center width=80%}
89+
![COVID-19 Case Tracking](images/coivd.png){#fig-covid-dashboard fig-align=center width=80% fig-alt=""}
9090
:::
9191

9292
Google's COVID tracking dashboard exemplified how modern visualization must be both accessible and updateable in real-time. The time series charts showed trends over months with clear visual indicators of peaks and valleys, but more importantly, they translated complex epidemiological data into something any concerned citizen could understand.

08-histograms/exercises.qmd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,14 @@ studio_distribution.show(6)
121121
```
122122

123123
```{python}
124+
#| fig-alt: "Distribution of studios responsible for the highest grossing movies as of 2017"
124125
studio_distribution.barh('Studio')
125126
```
126127

127128
Let's revisualize this barchart to display just the top five studios. In the below code, note how `.take` is used with `np.arange`:
128129

129130
```{python}
131+
#| fig-alt: "Distribution of studios responsible for the top five highest grossing movies as of 2017"
130132
studio_distribution.sort('count', descending=True).take(np.arange(5)).barh('Studio')
131133
print("Five studios are largely responsible for the highest grossing movies")
132134
```
@@ -157,12 +159,15 @@ min(ages), max(ages)
157159

158160
If you want to make equally sized bins, `np.arange()` is a great tool to help you.
159161
```{python}
162+
#| fig-alt: "Histogram of the age of the top grossing movies as of 2017 with equally sized bins and count on the y-axis"
160163
top_movies.hist('Age', bins = np.arange(0, 110, 10), unit = 'Year', density=False)
161164
```
162165

163166
## Histograms: Density
164167

165168
```{python}
169+
#| fig-alt: "Histogram of the age of the top grossing movies as of 2017 with equally sized bins and 'Percent per Year' on the y-axis"
170+
166171
# default is density=True
167172
top_movies.hist('Age', bins = np.arange(0, 110, 10), unit = 'Year')
168173
```
@@ -196,6 +201,7 @@ binned_data
196201
### Now, plot the histogram!
197202

198203
```{python}
204+
#| fig-alt: "Histogram of the age of the top grossing movies as of 2017 using custom bins"
199205
top_movies.hist('Age', bins = my_bins, unit = 'Year')
200206
```
201207

@@ -276,6 +282,7 @@ To check our work one last time, let's see if the numbers in the last column mat
276282

277283

278284
```{python}
285+
#| fig-alt: "Histogram of the age of the top grossing movies as of 2017 using custom bins"
279286
top_movies.hist('Age', bins = my_bins, unit = 'Year')
280287
```
281288

@@ -296,6 +303,7 @@ flavor_table
296303

297304

298305
```{python}
306+
#| fig-alt: "Distribution of ice cream flavors"
299307
flavor_table.barh('Flavor')
300308
```
301309

@@ -309,6 +317,7 @@ cone_average_price_table
309317

310318

311319
```{python}
320+
#| fig-alt: "Plot with one categorical attribute and one numerical attribute."
312321
cone_average_price_table.barh('Flavor')
313322
```
314323

@@ -324,5 +333,6 @@ cones_pivot_table
324333

325334

326335
```{python}
336+
#| fig-alt: "Plot with two categorical attributes."
327337
cones_pivot_table.barh('Color')
328338
```

0 commit comments

Comments
 (0)