Skip to content

Instantly share code, notes, and snippets.

@bennyistanto
Last active August 27, 2024 23:24
Show Gist options
  • Save bennyistanto/31c91f08991702d230f5ca6153455530 to your computer and use it in GitHub Desktop.
Save bennyistanto/31c91f08991702d230f5ca6153455530 to your computer and use it in GitHub Desktop.
Colorblind safe for GEEST classification

Colorblind safe for GEEST classification

geest_normal

The existing color scheme in the image uses a predominantly orange-red palette for most of the map, with some yellows, greens, and blues appearing minimally. While this scheme does show variation, it has several limitations. The heavy use of similar orange and red hues makes it difficult to distinguish between different levels of enablement and population, especially in the low to moderate ranges. Additionally, this color scheme may not be easily interpretable for individuals with color vision deficiencies.

I propose changing to a more effective color scheme based on the ColorBrewer RdYlBu (Red-Yellow-Blue) 5-class diverging color palette.

Baseline color 5-class RdYlBu

Color HEX RGB CMYK
#d7191c #d7191c rgb(215,25,28) cmyk(15,90,80,0)
#fdae61 #fdae61 rgb(253,174,97) cmyk(0,32,55,0)
#ffffbf #ffffbf rgb(255,255,191) cmyk(0,0,25,0)
#abd9e9 #abd9e9 rgb(171,217,233) cmyk(33,3,0,0)
#2c7bb6 #2c7bb6 rgb(44,123,182) cmyk(85,30,0,0)

Source: https://colorbrewer2.org/?type=diverging&scheme=RdYlBu&n=5

This scheme offers several advantages. It uses a broader range of distinct colors (red, orange, yellow, light blue, and dark blue) to represent the five levels of enablement, making them more easily distinguishable. Within each enablement level, consistent lightness variations represent population levels, providing a more systematic and intuitive approach. This new scheme is designed to be more colorblind-friendly, offers better contrast between categories, and allows for easier interpretation of both enablement and population levels across the entire map. The ColorBrewer-based palette ensures scientifically-derived color combinations that are perceptually effective and widely accessible. By adopting this color scheme, we can enhance the map's readability and make the data more accessible to a wider audience, including those with color vision deficiencies.

There are mathematical approaches to systematically adjust colors for low and high variations from a base color. One common method uses the HSL (Hue, Saturation, Lightness) color model to adjust the lightness while keeping the hue constant.

We can use a modified version of the HSL adjustment method to create a more systematic approach that better matches the aesthetic of the colors we've been working with. Here's a revised approach:

  1. Convert the base HEX color to HSL.
  2. For low population: Decrease lightness by 15% and increase saturation by 5%.
  3. For high population: Increase lightness by 15% and decrease saturation by 5%.

Let's apply this to our base colors:

  1. Very low enablement (#d7191c):
    • Low: #b11419
    • Medium: #d7191c (unchanged)
    • High: #f14247
  2. Low enablement (#fdae61):
    • Low: #d68f47
    • Medium: #fdae61 (unchanged)
    • High: #ffc688
  3. Moderately enabling (#ffffbf):
    • Low: #e6e6a3
    • Medium: #ffffbf (unchanged)
    • High: #ffffdb
  4. Enabling (#abd9e9):
    • Low: #8bbccd
    • Medium: #abd9e9 (unchanged)
    • High: #cbf0ff
  5. Highly enabling (#2c7bb6):
    • Low: #1d5c8d
    • Medium: #2c7bb6 (unchanged)
    • High: #4a9ae0

This approach provides a consistent method for deriving the low and high population colors from each base color, while maintaining the overall color scheme and ensuring good differentiation between categories.

Here's an updated version with these new color codes:

Breakdown color 5x3 class RdYlBu

Enablement Color Code Population Combined Class Color Code
Very low enablement Low #b11419 #b11419
Very low enablement #d7191c #d7191c Medium #d7191c #d7191c
Very low enablement High #f14247 #f14247
Low enablement Low #d68f47 #d68f47
Low enablement #fdae61 #fdae61 Medium #fdae61 #fdae61
Low enablement High #ffc688 #ffc688
Moderately enabling Low #e6e6a3 #e6e6a3
Moderately enabling #ffffbf #ffffbf Medium #ffffbf #ffffbf
Moderately enabling High #ffffdb #ffffdb
Enabling Low #8bbccd #8bbccd
Enabling #abd9e9 #abd9e9 Medium #abd9e9 #abd9e9
Enabling High #cbf0ff #cbf0ff
Highly enabling Low #1d5c8d #1d5c8d
Highly enabling #2c7bb6 #2c7bb6 Medium #2c7bb6 #2c7bb6
Highly enabling High #4a9ae0 #4a9ae0

Individual Dimension

For individual factor or variable, let's use RdYlBu (Red-Yellow-Blue) 6-class diverging color palette

6-class RdYlBu

Color HEX RGB CMYK
#d73027 #d73027 rgb(215,48,39) cmyk(15,80,75,0)
#fc8d59 #fc8d59 rgb(252,141,89) cmyk(0,45,55,0)
#fee090 #fee090 rgb(254,224,144) cmyk(0,12,40,0)
#e0f3f8 #e0f3f8 rgb(224,243,248) cmyk(12,0,0,0)
#91bfdb #91bfdb rgb(145,191,219) cmyk(43,11,0,0)
#4575b4 #4575b4 rgb(69,117,180) cmyk(75,37,0,0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment