Skip to content

Instantly share code, notes, and snippets.

@avivajpeyi
Last active June 14, 2021 03:44
Show Gist options
  • Save avivajpeyi/4d9839b1ceb7d3651cbb469bc6b0d69b to your computer and use it in GitHub Desktop.
Save avivajpeyi/4d9839b1ceb7d3651cbb469bc6b0d69b to your computer and use it in GitHub Desktop.
Matplotlib publication stylesheet
### FIGURE
figure.facecolor: white
figure.dpi: 300
figure.titlesize: x-large # fontsize of the axes title
figure.titleweight: bold
### LINES
lines.linewidth: 1.5
### PATCHES
patch.facecolor: 0072B2
### LEGEND
legend.fontsize: large
legend.fancybox : False # True for rounded box
### TICKS
xtick.direction: in # direction: {in, out, inout}
xtick.top: True # draw ticks on the top side
xtick.bottom: True # draw ticks on the bottom side
xtick.major.size: 6 # major tick size in points
xtick.minor.size: 3 # minor tick size in points
xtick.major.width: 0.8 # major tick width in points
xtick.minor.width: 0.6 # minor tick width in points
xtick.labelsize: medium # font size of the tick labels
xtick.minor.visible: True # visibility of minor ticks on x-axis
xtick.major.top: True # draw x axis top major ticks
xtick.major.bottom: True # draw x axis bottom major ticks
xtick.minor.top: True # draw x axis top minor ticks
xtick.minor.bottom: True # draw x axis bottom minor ticks
xtick.major.pad: 5 # distance to major tick label in points
xtick.minor.pad: 3.4 # distance to the minor tick label in points
ytick.direction: in # direction: {in, out, inout}
ytick.left: True # draw ticks on the top side
ytick.right: True # draw ticks on the bottom side
ytick.major.size: 6 # major tick size in points
ytick.minor.size: 3 # minor tick size in points
ytick.major.width: 0.8 # major tick width in points
ytick.minor.width: 0.6 # minor tick width in points
ytick.labelsize: medium # font size of the tick labels
ytick.minor.visible: True # visibility of minor ticks on y-axis
ytick.major.left: True # draw y axis left major ticks
ytick.major.right: True # draw y axis right major ticks
ytick.minor.left: True # draw y axis left minor ticks
ytick.minor.right: True # draw y axis right minor ticks
ytick.major.pad: 5 # distance to major tick label in points
ytick.minor.pad: 3.4 # distance to the minor tick label in points
### FONTS
font.family: serif
font.weight: normal
font.size: 15
font.serif: Computer Modern Roman
font.sans-serif: Computer Modern Sans Serif
text.usetex: True
### AXES
axes.grid: True
axes.titlesize : x-large # fontsize of the axes title
axes.labelsize : x-large # fontsize of the x any y labels
axes.facecolor: white
axes.linewidth: 1.0
axes.titleweight: normal
axes.spines.top: True
axes.spines.right: True
axes.spines.bottom: True
axes.spines.left: True
axes.prop_cycle: cycler('color', ['0072B2', '009E73', 'D55E00', 'CC79A7', 'F0E442', '56B4E9'])
### GRID
grid.color: b0b0b0 # grid color
grid.linestyle: -- # solid
grid.linewidth: 0.8 # in points
grid.alpha: 1.0 # transparency, between 0.0 and 1.0
@avivajpeyi
Copy link
Author

avivajpeyi commented Jun 4, 2021

To use this run the following code:

import matplotlib.pyplot as plt
try:
    plt.style.use('https://gist.githubusercontent.com/avivajpeyi/4d9839b1ceb7d3651cbb469bc6b0d69b/raw/4ee4a870126653d542572372ff3eee4e89abcab0/publication.mplstyle')
except Exception:
    plt.style.use('seaborn-whitegrid')

More customizations can be found on the matplotlib rc page.

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