Giter Site home page Giter Site logo

cud's Introduction

Color Universal Design colourblind-friendly python matplotlib palette

This repository contains a python file cud.py which contains a dictionary, list, and associated function for creating a palette based on the Color Universal Design.

- Hex Color
#000000 #000000 Black
#e69f00 #e69f00 Orange
#56b4e9 #56b4e9 Skyblue
#009e73 #009e73 Bluish Green
#f0e442 #f0e442 Yellow
#0072b2 #0072b2 Blue
#d55e00 #d55e00 Vermilion
#cc79a7 #cc79a7 Redish Purple

Usage

Copy and paste the contents of cud.py into your project and use the cud() function as follows.

The standard 8-colour palette

palette = cud()
plot_colourtable(palette)

standard palette

Or you can offset and start from the second colour

palette = cud(start=1)
plot_colourtable(palette)

offset palette

Or only select three colours

palette = cud(n=3)
plot_colourtable(palette)

three palette

See utils.py for the code used to generate the above plots.

A common usecase for such a palette would be with seaborn

import seaborn as sns
sns.set_theme(style="whitegrid")
penguins = sns.load_dataset("penguins")
palette = cud()
# Draw a nested barplot by species and sex
g = sns.catplot(
    data=penguins, kind="bar",
    x="species", y="body_mass_g", hue="sex",
    errorbar="sd", alpha=.6, height=6,
    palette=palette
)
g.despine(left=True)
g.set_axis_labels("", "Body mass (g)")
g.legend.set_title("")

seaborn palette

cud's People

Contributors

mbhall88 avatar ammaraziz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.