Plot guides › How-to

Make a colour-blind friendly plot

Around 1 in 12 men has some form of colour vision deficiency, most often red-green. A colour-blind safe palette such as Okabe-Ito, combined with different markers or line styles, keeps every series distinguishable, even printed in grayscale.

Example make a colour-blind friendly plot made with matplotlib
Rendered from the code below, with example data.

When to use it

Watch out: Avoid the jet/rainbow colormap for continuous data; use viridis, cividis or another perceptually uniform map.

Ask for it in pltchat

Upload your file and type something like:

"use a colour-blind safe palette and different markers for each group"

pltchat writes the loader and the plot for your columns, runs it in your browser and shows you the code.

The matplotlib code

Self-contained with example data; swap in pd.read_csv(...) or pd.read_excel(...) for your own file.

import numpy as np
import matplotlib.pyplot as plt

OKABE_ITO = ["#E69F00", "#56B4E9", "#009E73", "#F0E442",
             "#0072B2", "#D55E00", "#CC79A7", "#000000"]
plt.rcParams["axes.prop_cycle"] = plt.cycler(color=OKABE_ITO)
# Built-in alternative: plt.style.use("tableau-colorblind10")

x = np.arange(10)
markers = ["o", "s", "^", "D", "v"]
fig, ax = plt.subplots(figsize=(6.4, 4))
for i, m in enumerate(markers):
    ax.plot(x, x * (0.5 + 0.3 * i), marker=m, label=f"Group {i + 1}")
ax.set_xlabel("Dose")
ax.set_ylabel("Response")
ax.legend()
plt.tight_layout()
plt.show()

Make this with your data

Upload a CSV, Excel, JSON or Parquet file. Your first plot is always free.

Related plots