Created
July 4, 2017 09:13
-
-
Save jorgecarleitao/90d636728e3c6133ce5748e7486fab9c to your computer and use it in GitHub Desktop.
A minimal change of settings parameters for quality images with matplotlib
This file contains hidden or 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 | |
def set_plot_settings(font_size=18): | |
# a font that is very close to LaTeX. | |
plt.rcParams['mathtext.fontset'] = 'stix' | |
plt.rcParams['font.family'] = 'STIXGeneral' | |
# ticks with the same width as axis, and consistent with font size (below) | |
plt.rcParams['axes.linewidth'] = 1 | |
plt.rcParams['xtick.major.width'] = 1 | |
plt.rcParams['ytick.major.width'] = 1 | |
# set grid to be very light so it does not distract | |
plt.rcParams['grid.alpha'] = 0.2 | |
# there is no reason for an alpha != 1 for the legend box (anything beneath it is distracting) | |
plt.rcParams['legend.framealpha'] = 1 | |
# They should depend on the size you give to the figure, but should be equal. | |
plt.rcParams['axes.labelsize'] = font_size | |
plt.rcParams['xtick.labelsize'] = font_size | |
plt.rcParams['ytick.labelsize'] = font_size | |
plt.rcParams['legend.fontsize'] = font_size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment