-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpltstyle.py
77 lines (60 loc) · 1.91 KB
/
pltstyle.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
font_size = 11
plt.rcParams.update({
'figure.figsize': (8, 6),
'figure.dpi': 120,
'figure.titlesize': font_size,
'figure.titleweight': 'bold',
'figure.autolayout': True,
'lines.marker': 'o',
'lines.linewidth': 1.5,
'font.weight': 'light',
'font.size': font_size,
'axes.titlesize': font_size,
'axes.titleweight': 'light',
'axes.labelsize': font_size - 2,
'axes.labelweight': 'light',
'axes.grid': True,
'axes.grid.axis': 'both',
'axes.grid.which': 'both',
'axes.formatter.use_mathtext': True,
'axes.formatter.limits': (-2, 3),
'xtick.direction': 'in',
'xtick.minor.visible': True,
'xtick.major.size': 5,
'xtick.minor.size': 3,
'xtick.labelsize': font_size - 2,
'ytick.direction': 'in',
'ytick.minor.visible': True,
'ytick.major.size': 5,
'ytick.minor.size': 3,
'ytick.labelsize': font_size - 2,
'legend.loc': 'best',
'legend.frameon': True,
'legend.framealpha': 0.5,
'legend.fancybox': True,
'legend.shadow': False,
'legend.fontsize': font_size - 4,
'grid.color': 'gray',
'grid.linestyle': '-',
'grid.linewidth': 0.5,
'grid.alpha': 0.7,
'savefig.bbox': 'tight',
'savefig.format': 'png',
})
def create_plots(x_label=r'Concentration $\rm{[\mu M]}$',
y_label=r'Intensity $\rm{[AU]}$',
suptitle='', plot_title='',
*args, **kwargs):
fig, ax = plt.subplots(*args, **kwargs)
ax.grid(which='major', linestyle=':', linewidth='0.5', color='gray')
ax.grid(which='minor', linestyle=':', linewidth='0.5', color='lightgray')
if suptitle != '':
fig.suptitle(f'{suptitle}')
if plot_title != '':
ax.set_title(f'{plot_title}')
ax.set_xlabel(f'{x_label}')
ax.set_ylabel(f'{y_label}')
return fig, ax