Skip to content

Instantly share code, notes, and snippets.

@masterdesky
Last active March 29, 2026 14:41
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.pyplot as plt
okabe_ito = [
'#000000', '#E69F00', '#56B4E9', '#009E73',
'#F0E442', '#0072B2', '#D55E00', '#CC79A7',
]
custom_settings: dict = {
'axes.prop_cycle': cycler(color=okabe_ito),
'figure.facecolor': '#ffffff',
'axes.facecolor': '#ffffff',
'axes.edgecolor': '0.3',
'axes.linewidth': 1,
'axes.grid': False,
'grid.color': '0.7',
'grid.linestyle': ':',
'grid.alpha': 0.6,
'figure.dpi': 150,
'savefig.dpi': 300,
}
text_settings: dict = {
'text.usetex': True,
'font.family': 'serif',
'font.serif': ['Computer Modern Roman'],
'axes.unicode_minus': False,
}
for t in ('xtick', 'ytick'):
custom_settings[f'{t}.direction'] = 'in'
custom_settings[f'{t}.bottom' if t == 'xtick' else f'{t}.left'] = True
custom_settings[f'{t}.top' if t == 'xtick' else f'{t}.right'] = True
custom_settings[f'{t}.color'] = '0.3'
for m in ('major', 'minor'):
custom_settings[f'{t}.{m}.width'] = 1
custom_settings[f'{t}.{m}.size'] = 6 if m == 'major' else 3
plt.rcParams.update(custom_settings)
plt.rcParams.update(text_settings)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment