-
Notifications
You must be signed in to change notification settings - Fork 10
/
style.py
48 lines (40 loc) · 1.33 KB
/
style.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import matplotlib as mpl
import matplotlib.font_manager as fm
import seaborn as sns
TITLE_COLOR = '#212121'
AXIS_COLOR = '#757575'
GRID_COLOR = '#eeeeee' # Previously lighter #f5f5f5.
DPI = 200
def set_plot_style():
""" Set plot style.
Args:
None.
Returns:
Nothing. Sets style.
"""
sns.set_style('white')
# Set up Roboto. Must be downloaded in the current directory.
# See https://stackoverflow.com/a/51844978/1840471.
fm.fontManager.ttflist += fm.createFontList(['Roboto-Regular.ttf'])
STYLE = {
'savefig.dpi': DPI,
'figure.dpi': DPI,
'figure.figsize': (6.4, 4.8), # Default.
'font.sans-serif': 'Roboto',
'font.family': 'sans-serif',
# Set title text color to dark gray (https://material.io/color) not black.
'text.color': TITLE_COLOR,
# Axis titles and tick marks are medium gray.
'axes.labelcolor': AXIS_COLOR,
'xtick.color': AXIS_COLOR,
'ytick.color': AXIS_COLOR,
# Grid is light gray.
'axes.grid' : True,
'grid.color': GRID_COLOR,
# Equivalent to seaborn.despine(left=True, bottom=True).
'axes.spines.left': False,
'axes.spines.right': False,
'axes.spines.top': False,
'axes.spines.bottom': False
}
mpl.rcParams.update(STYLE)