-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot_settings.py
More file actions
111 lines (98 loc) · 3.54 KB
/
plot_settings.py
File metadata and controls
111 lines (98 loc) · 3.54 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/python
# Module: plot_settings.py
# Author: Varun Hiremath <vh63@cornell.edu>
# Created: Thu, 2 Apr 2009 05:06:31 -0400
import pylab, math
# Symbols
symbols = ['-','--','-.',':','.',',','o','^','v','<','>','s','+','x','D','d','1','2','3','4','h','H','p']
# Symbols + line
lps = [k+'-' for k in [',','.','o','^','v','<','>','s','+','x','D','d','1','2','3','4','h','H','p']]
# Colors
colors= ['b','g','r','c','m','y','k','w']
def get_figsize(fig_width_pt):
inches_per_pt = 1.0/72.27 # Convert pt to inch
golden_mean = (math.sqrt(5)-1.0)/2.0 # Aesthetic ratio
fig_width = fig_width_pt*inches_per_pt # width in inches
fig_height = fig_width*golden_mean # height in inches
fig_size = [fig_width,fig_height] # exact figsize
return fig_size
def get_figsize45(fig_width_pt):
inches_per_pt = 1.0/72.27
fig_width = fig_width_pt * inches_per_pt
fig_height = fig_width * 4/5
fig_size = [fig_width, fig_height]
return fig_size
# Publishable quality image settings for 2-column papers
params0 = {'backend': 'eps',
'axes.labelsize': 6,
'text.fontsize': 6,
'xtick.labelsize': 6,
'ytick.labelsize': 6,
'legend.pad': 0.1, # empty space around the legend box
'legend.fontsize': 5,
'lines.markersize': 3,
'font.size': 6,
'text.usetex': True,
'figure.figsize': get_figsize(250)}
params_mini = {'backend': 'pdf',
'axes.labelsize': 16,
'text.fontsize': 16,
'xtick.labelsize': 16,
'ytick.labelsize': 16,
'legend.pad': 0.1, # empty space around the legend box
'legend.fontsize': 16,
'lines.markersize': 3,
'font.size': 16,
'font.family': 'serif',
'text.usetex': True,
'figure.figsize': get_figsize45(350.0)}
params_icdl = {'backend': 'pdf',
'axes.labelsize': 8,
'text.fontsize': 8,
'xtick.labelsize': 8,
'ytick.labelsize': 8,
'legend.pad': 0.1, # empty space around the legend box
'legend.fontsize': 8,
'lines.markersize': 3,
'font.size': 8,
'font.family': 'serif',
'text.usetex': True,
'figure.figsize': get_figsize(516.0)}
# Medium sized images
params1 = {'backend': 'eps',
'axes.labelsize': 8,
'text.fontsize': 8,
'xtick.labelsize': 8,
'ytick.labelsize': 8,
'legend.pad': 0.1, # empty space around the legend box
'legend.fontsize': 8,
'lines.markersize': 3,
'font.size': 8,
'text.usetex': True,
'figure.figsize': get_figsize(520)}
# Large images (default)
params2 = {'backend': 'eps',
'axes.labelsize': 10,
'text.fontsize': 10,
'xtick.labelsize': 10,
'ytick.labelsize': 10,
'legend.pad': 0.2, # empty space around the legend box
'legend.fontsize': 10,
'lines.markersize': 3,
'font.size': 10,
'text.usetex': True,
'figure.figsize': get_figsize(800)}
def set_mode(mode):
if mode == "publish":
pylab.rcParams.update(params0)
elif mode == "medium":
pylab.rcParams.update(params1)
elif mode == "icdl":
pylab.rcParams.update(params_icdl)
elif mode == "mini":
pylab.rcParams.update(params_mini)
else:
pylab.rcParams.update(params2)
def set_figsize(fig_width_pt):
pylab.rcParams['figure.figsize'] = get_figsize(fig_width_pt)
pylab.rcParams.update(params2)