Skip to content

Instantly share code, notes, and snippets.

@nikosavola
Last active January 23, 2023 12:46
Show Gist options
  • Save nikosavola/5a75e02bf23e915c50eb0310d2fcb026 to your computer and use it in GitHub Desktop.
Save nikosavola/5a75e02bf23e915c50eb0310d2fcb026 to your computer and use it in GitHub Desktop.
Style configuration for Matplotlib. Save to ~/.matplotlib/stylelib
## https://matplotlib.org/3.3.3/tutorials/introductory/customizing.html
axes.prop_cycle : cycler('color', ['008fd5', 'fc4f30', '68dc9b', 'ffdf54', '8b8b8b', '810f7c']) # Modified fivethirtyeight
axes.xmargin : 0 # axis tight
axes.facecolor : white # background colour
axes.linewidth : 1.2
font.family : serif
font.sans-serif : Arial
font.serif : Adobe Text Pro
# font.serif : cmr10 # CMU Serif
# axes.unicode_minus : False # fix unicode minus from cmr10
font.size : 12
axes.titlesize : 12
axes.labelsize : 12
xtick.labelsize : 12
ytick.labelsize : 12
legend.fontsize: 12
figure.titlesize: 12
# Very slow but fancy
# text.usetex : True
# text.latex.preamble : \usepackage[libertine]{newtxmath}
axes.formatter.use_mathtext : True
# mathtext.fontset : cm
mathtext.fontset : custom
mathtext.it : Libertinus Serif:italic
mathtext.rm : Libertinus Math
mathtext.tt : Source Code Variable
mathtext.bf : Libertinus Serif:bold
lines.linewidth : 1.8
lines.markersize : 4.2
lines.dashed_pattern: 3.7, 2.0
lines.dash_capstyle : round
lines.dash_joinstyle : round
lines.scale_dashes : True
legend.loc : best
legend.fancybox : True
legend.frameon : False
legend.shadow : False
legend.borderpad : 0.25
figure.autolayout : True
image.aspect : equal
image.interpolation : antialiased
image.cmap : magma # spring
image.lut : 256
image.composite_image: True
@nikosavola
Copy link
Author

Additionally, one can create ~\.ipython\profile_default\ipython_config.py and add:

c.InteractiveShellApp.exec_lines = [
    "import matplotlib.pyplot as plt",
    "plt.style.use('niko')",
]

This makes the style default on Jupyter Notebooks.

@nikosavola
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment