Last active
September 6, 2021 18:52
-
-
Save selflein/3c58773d71de61968d41c15673b2150c to your computer and use it in GitHub Desktop.
[Seaborn settings for paper plots] #matplotlib #publication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import seaborn as sns | |
sns.set() | |
sns.set_style("ticks") | |
sns.set_context("paper", font_scale=1.0) | |
params = { | |
'text.usetex' : True, | |
'font.size' : 11, | |
"font.serif": [], | |
"font.sans-serif": [], | |
"font.monospace": [], | |
"pgf.rcfonts": False, # don't setup fonts from rc parameters | |
"font.family": "serif", | |
"text.latex.preamble": [ | |
r"\usepackage{lmodern}", | |
r"\usepackage{amsmath}", | |
], | |
"pgf.preamble": [ | |
r"\usepackage{lmodern}", | |
r"\usepackage{amsmath}", | |
], | |
} | |
import matplotlib.font_manager | |
plt.rcParams.update(params) | |
# Plot something here | |
ax.ticklabel_format(useMathText=True, scilimits=(3,0), style="sci") | |
sns.despine(ax=ax) | |
ax.figure.savefig("path/to/somewhere.png", pad_inches=0.0, bbox_inches="tight", dpi=300) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment