Last active
February 23, 2024 12:09
-
-
Save pratikunterwegs/2b660a3f8bc44432ecf9a41284081faa to your computer and use it in GitHub Desktop.
Trial a categorical palette from Epiverse colours
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Examining Epiverse colours for categorical palettes #### | |
library(colorspace) | |
pal_original = c( | |
black = "#071E2D", grey = "#888888", red = "#F04A4C", blue = "#106BA0", | |
green = "#AEC800", teal = "#10BED2", yellow = "#DEFF00", white = "#EBE6E0" | |
) | |
specplot(pal_original) | |
# NOTE: luminance needs to be relatively similar for equal perceptual weight | |
# to each colour for categorical data | |
# First adjust blue to be 20% lighter to match grey and red | |
pal_adjusted = pal_original | |
pal_adjusted["blue"] = lighten(pal_original["blue"], 0.25) | |
specplot(pal_adjusted) | |
# Then adjust green to be darkr to match others | |
pal_adjusted["green"] = darken(pal_adjusted["green"], 0.2) | |
specplot(pal_adjusted) | |
# Darken 'yellow' to match others | |
pal_adjusted["yellow"] = darken(pal_adjusted["yellow"], 0.35) | |
specplot(pal_adjusted) | |
# too similar to existing green | |
# Darken 'teal' to match others | |
pal_adjusted["teal"] = darken(pal_adjusted["teal"], 0.1) | |
specplot(pal_adjusted) | |
# Darken 'white' to match others | |
pal_adjusted["white"] = darken(pal_adjusted["white"], 0.3) | |
specplot(pal_adjusted) | |
# too similar to existing grey | |
# lighten 'black' | |
pal_adjusted["black"] = lighten(pal_adjusted["black"], 0.5) | |
specplot(pal_adjusted) | |
# too similar to existing greys | |
# desaturate red to reduce chroma | |
pal_adjusted["red"] = desaturate(pal_adjusted["red"], 0.5) | |
specplot(pal_adjusted) | |
# Visualise in an online palette checker | |
# https://projects.susielu.com/viz-palette?colors=[%22#7C8590%22,%22#888888%22,%22#C66C6D%22,%22#508FC4%22,%22#889D03%22,%22#12A9BB%22,%22#899E00%22,%22#A49A8D%22]&backgroundColor=%22white%22&fontColor=%22black%22&mode=%22normal%22 | |
# Comparison with existing categorical palette | |
specplot(qualitative_hcl(7)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment