-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_settings.py
More file actions
75 lines (65 loc) · 2.39 KB
/
plot_settings.py
File metadata and controls
75 lines (65 loc) · 2.39 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
# Module: plot_settings.py
# Author: Varun Hiremath <vh63@cornell.edu>
# Created: Thu, 2 Apr 2009 05:06:31 -0400
#
# Note: Copied by TME - this looks useful!
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.0 # 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
# 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)}
# 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(500)}
# 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)
else:
pylab.rcParams.update(params2)
def set_figsize(fig_width_pt):
pylab.rcParams['figure.figsize'] = get_figsize(fig_width_pt)
pylab.rcParams.update(params2)