Skip to content

Instantly share code, notes, and snippets.

@masterdesky
Last active August 26, 2025 22:37
Show Gist options
  • Select an option

  • Save masterdesky/8ab467fd19d2160eb73f25b1a8fb459d to your computer and use it in GitHub Desktop.

Select an option

Save masterdesky/8ab467fd19d2160eb73f25b1a8fb459d to your computer and use it in GitHub Desktop.
Configuration for the visual style of my educational plots in Python
from cycler import cycler
import matplotlib as mpl
import matplotlib.pyplot as plt
# Okabe-Ito color palette
okabe_ito = [
"#000000", "#E69F00", "#56B4E9", "#009E73",
"#F0E442", "#0072B2", "#D55E00", "#CC79A7"
]
# Facecolor values (#f4f0e8) from S. Conradi @S_Conradi/@profConradi
custom_settings = {
'axes.prop_cycle': cycler(color=okabe_ito),
'figure.facecolor': '#f4f0e8',
'axes.facecolor': '#f4f0e8',
'axes.edgecolor': '0.3',
'axes.linewidth' : '0.5',
'axes.grid': False,
'grid.color': '0.7',
'grid.linestyle': ':',
'grid.alpha': 0.6,
'xtick.bottom': True,
'xtick.top': True,
'ytick.left': True,
'ytick.right': True,
}
for t in ['xtick', 'ytick']:
custom_settings[f'{t}.direction'] = 'in'
custom_settings[f'{t}.color'] = '0.3'
for m in ['major', 'minor']:
custom_settings[f'{t}.{m}.width'] = 0.5
custom_settings[f'{t}.{m}.size'] = 6 if m == 'major' else 3
mpl.rcParams.update(custom_settings)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment