In the last lecture we have made basic data visualizations. In this lecture we will improve them to make them more accessible.
We can change axes and plot labels using the labs()
function.
Theme gray is the default theme in ggplot.
The theme()
function allows for many components of a theme. By typing ?theme
in the Console, you can read the documentation of the function to see what components can be modified.
One can also set the default font size of theme. For instance, if you utilize the following code at the first chunk of a Quarto document, all plots will be in gray theme and will have a font size of 22.
Previously species were only distinguishable to someone who could distinguish these colors. By using shapes, color-blind viewers can also distinguish the species.
By storing the plot as an object named species_bills
, we will be able to use it in other functions.
The cvd_grid()
function from the colorblindr()
package creates a grid of different color-deficiency simulations.
Deuteranomaly
is reduced sensitivity to green light Protanomaly
, is reduced sensitivity to red light Tritanomaly
is reduced sensitivity to blue light Desaturated
is no color difference
In 2008, Masataka Okabe and Kei Ito proposed a color palette that is accessible to people with various color deficiencies. We use their last names referring to the color palette.
The codes displayed with a hashtag are called hex color code. You can use hex codes in R (and in HTML) to specify colors.
Top Ten Dos and Don’t for Charts and Graphs
We cannot learn every single ggplot feature in a single week but a little but an internet search and a few examples can go a long way in improving your visualizations.
Assistive Technology is any form of technology (software, device) that helps people with disabilities perform certain activities.
Examples:
A screen reader is an assistive technology that supports blind or visually impaired people in using their computer.
The video shows use of a screen reader briefly.
Chart type
Type of data
Reason for including the chart
Link to data or source (not in alt text but in main text)
Description conveys meaning in the data
Variables included on the axes
Scale described within the description
Type of plot is described
The automated alternate text for this plot is on the next slide.
This is an untitled chart with no subtitle or caption.
It has x-axis 'transmission' with labels automatic and manual.
It has y-axis 'count' with labels 0, 5, 10 and 15.
The chart is a bar chart with 2 vertical bars.
Bar 1 is centered at 1, and length is from 0 to 19.
Bar 2 is centered at 2, and length is from 0 to 13.
Drawback of using VI()
is that not every type of plot can be verbalized yet.
```{r}
#| fig-align: center
#| fig-cap: Relationship between bill depth (mm) and length (mm) for different species of penguins
#| fig-alt: The scatterplot shows bill depth in mm on the x-axis and bill length in mm on the y-axis with points differently colored for different species as Adelie, Chinstrap, and Gentoo. The x axis ranges from about 12.5 mm to 22.5 mm. The y-axis ranges from about 30 to 60 mm. For all species the relationship seems moderately positive. When comparing the three species, Adelie penguins seem to have longer bill depth but shorter bill length. Chinstraps have longer bill depth and longer bill length. Gentoo penguins have shorter bill depth and longer bill length.
ggplot(penguins, aes(x = bill_depth_mm,
y = bill_length_mm,
color = species)) +
geom_point(size = 4)
```
Data sonification is the presentation of data as sound.
Data tactulization refers to making data visualization in a form so that it can be touchable. The video shows printing of a tactile boxplot.