diff --git a/_book_production/balance_data_context_files/figure-html/price-plot-ggplot-default-1.png b/_book_production/balance_data_context_files/figure-html/price-plot-ggplot-default-1.png index cb30d32f..43e93813 100644 Binary files a/_book_production/balance_data_context_files/figure-html/price-plot-ggplot-default-1.png and b/_book_production/balance_data_context_files/figure-html/price-plot-ggplot-default-1.png differ diff --git a/_book_production/balance_data_context_files/figure-html/price-plot-hgrid-1.png b/_book_production/balance_data_context_files/figure-html/price-plot-hgrid-1.png index 28328897..5e4ca22f 100644 Binary files a/_book_production/balance_data_context_files/figure-html/price-plot-hgrid-1.png and b/_book_production/balance_data_context_files/figure-html/price-plot-hgrid-1.png differ diff --git a/_book_production/balance_data_context_files/figure-html/price-plot-no-grid-1.png b/_book_production/balance_data_context_files/figure-html/price-plot-no-grid-1.png index dfbf586c..efecc575 100644 Binary files a/_book_production/balance_data_context_files/figure-html/price-plot-no-grid-1.png and b/_book_production/balance_data_context_files/figure-html/price-plot-no-grid-1.png differ diff --git a/_book_production/balance_data_context_files/figure-html/price-plot-refline-1.png b/_book_production/balance_data_context_files/figure-html/price-plot-refline-1.png index 503ab247..1ea0f2f1 100644 Binary files a/_book_production/balance_data_context_files/figure-html/price-plot-refline-1.png and b/_book_production/balance_data_context_files/figure-html/price-plot-refline-1.png differ diff --git a/_book_production/color-pitfalls.html b/_book_production/color-pitfalls.html index 90bde4e2..ce8d4631 100644 --- a/_book_production/color-pitfalls.html +++ b/_book_production/color-pitfalls.html @@ -298,7 +298,7 @@
In Chapter 4, I listed two critical conditions for designing sequential color scales that can represent data values: The colors need to clearly indicate which data values are larger or smaller than which other ones, and the differences between colors need to visualize the corresponding differences between data values. Unfortunately, several existing color scales—including very popular ones—violate one or both of these conditions. The most popular such scale is the rainbow scale (Figure 19.4). It runs through all possible colors in the color spectrum. This means the scale is effectively circular; the colors at the beginning and the end are nearly the same (dark red). If these two colors end up next to each other in a plot, we do not instinctively perceive them as representing data values that are maximally apart. In addition, the scale is highly non-monotonic. It has regions where colors change very slowly and others when colors change rapidly. This lack of monotonicity becomes particularly apparent if we look at the color scale in grayscale (Figure 19.4). The scale goes from medium dark to light to very dark and back to medium dark, and there are large stretches where lightness changes very little followed by relatively narrow stretches with large changes in lightness.
As discussed in Chapter 4, there are three fundamental types of color scales used in data visualization: sequential scales, diverging scales, and qualitative scales. Of these three, sequential scales will generally not cause any problems for people with color-vision deficiency (cvd), since a properly designed sequential scale should present a continuous gradient from dark to light colors. Figure 19.6 shows the Heat scale from Figure 4.3 in simulated versions of deuteranomaly, protanomaly, and tritanomaly. While none of these cvd-simulated scales look like the original, they all present a clear gradient from dark to light and they all work well to convey the magnitude of a data value.
Things become more complicated for diverging scales, because popular color contrasts can become indistinguishable under cvd. In particular, the colors red and green provide about the strongest contrast for people with normal color vision but become nearly indistinguishable for deutans (people with deuteranomaly) or protans (people with protanomaly) (Figure 19.7). Similarly, blue-green contrasts are visible for deutans and protans but become indistinguishable for tritans (people with tritanomaly) (Figure 19.8).
With these examples, it might seem that it is nearly impossible to find two contrasting colors that are safe under all forms of cvd. However, the situation is not that dire. It is often possible to make slight modifications to the colors such that they have the desired character while also being safe for cvd. For example, the ColorBrewer PiYG (pink to yellow-green) scale from Figure 4.5 looks red–green to people with normal color vision yet remains distinguishable for people with cvd (Figure 19.9).
While there are several good, cvd-safe color scales readily available, we need to recognize that they are no magic bullets. It is very possible to use a cvd-safe scale and yet produce a figure a person with cvd cannot decipher. One critical parameter is the size of the colored graphical elements. Colors are much easier to distinguish when they are applied to large areas than to small ones or thin lines (Stone, Albers Szafir, and Setlur 2014). And this effect is exacerbated under cvd (Figure 19.11). In addition to the various color-design considerations discussed in this chapter and in Chapter 4, I recommend to view color figures under cvd simulations to get a sense of what they may look like for a person with cvd. There are several online services and desktop apps available that allow users to run arbitrary figures through a cvd simulation.
Surprisingly, the green and blue points look more distinct for people with red–green color-vision-deficiency (deuteranomaly or protanomaly) than for people with normal color vision (compare Figure 20.2, top row, to Figure 20.1). On the other hand, for people with blue–yellow deficiency (tritanomaly) the blue and green points look very similar (Figure 20.2, bottom left). And if we print out the figure in gray-scale (i.e., we desaturate the figure), we cannot distinguish any of the iris species (Figure 20.2, bottom right).
Matching the legend order to the data order is always helpful, but the benefits are particularly obvious under color-vision deficiency simulation (Figure 20.7). For example, it helps in the tritanomaly version of the figure, where the blue and the green become difficult to distinguish (Figure 20.7, bottom left). It also helps in the grayscale version (Figure 20.7, bottom right). Even though the two colors for Facebook and Alphabet have virtually the same gray value, we can see that Microsoft and Apple are represented by darker colors and take the bottom two spots. Therefore, we correctly assume that the highest line corresponds to Facebook and the second-highest line to Alphabet.
We can also use density plots such as the one in Figure 20.10 as a legend replacement, by placing the density plots into the margins of a scatter plot (Figure 20.11). This allows us to direct-label the marginal density plots rather than the central scatter plot and hence results in a figure that is somewhat less cluttered than Figure 20.9 with directly-labeled ellipses.