diff options
author | Christopher Kenna <cjk@cs.unc.edu> | 2011-10-18 22:24:51 -0400 |
---|---|---|
committer | Christopher Kenna <cjk@cs.unc.edu> | 2011-10-18 22:24:51 -0400 |
commit | 6469f7be7b5edf73b9ecd8d498199961a8be3dd9 (patch) | |
tree | 3c0b8aa7e6182e3de3ecce5819a8863d9fcc218f /plot_rtas12_betaexp.py | |
parent | 8ef8c63dda2f75b312a9b1a6194271de6cc8a449 (diff) |
add png format, too
Diffstat (limited to 'plot_rtas12_betaexp.py')
-rwxr-xr-x | plot_rtas12_betaexp.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/plot_rtas12_betaexp.py b/plot_rtas12_betaexp.py index 11f29b3..2153222 100755 --- a/plot_rtas12_betaexp.py +++ b/plot_rtas12_betaexp.py | |||
@@ -43,11 +43,18 @@ def get_y_label(metric): | |||
43 | return LABELS[metric] | 43 | return LABELS[metric] |
44 | 44 | ||
45 | 45 | ||
46 | def set_plot_opts(p): | 46 | def set_plot_opts(opts, p): |
47 | p.rounded_caps = True | 47 | p.rounded_caps = True |
48 | p.font = 'Helvetica' | 48 | p.font = 'Helvetica' |
49 | p.font_size = '5pt' | 49 | if opts.paper: |
50 | p.size = ('8.5cm', '5.25cm') | 50 | ext = 'pdf' |
51 | p.size = ('8.5cm', '5.25cm') | ||
52 | p.font_size = '5pt' | ||
53 | else: | ||
54 | ext = 'png' | ||
55 | p.size = (1024, 768) | ||
56 | p.output = '{0}.{1}'.format(p.output, ext) | ||
57 | p.format = ext | ||
51 | p.default_style = 'linespoints lw 2.5' | 58 | p.default_style = 'linespoints lw 2.5' |
52 | p.default_style += ' smooth bezier' | 59 | p.default_style += ' smooth bezier' |
53 | p.monochrome = False | 60 | p.monochrome = False |
@@ -66,16 +73,13 @@ def plot_metric(opts, dat_dir, metric, coin_prob, xr=None): | |||
66 | """Plot metric for each level, enforcement pair at the specified | 73 | """Plot metric for each level, enforcement pair at the specified |
67 | probability. | 74 | probability. |
68 | 75 | ||
69 | .""" | 76 | """ |
70 | # each coin value gets a plot | 77 | # each coin value gets a plot |
71 | p = Plot() | 78 | p = Plot() |
72 | p.output = '{0}/beta-exp-metric={1}-prob={2}'.format( | 79 | p.output = '{0}/beta-exp-metric={1}-prob={2}'.format( |
73 | dat_dir, metric, str(coin_prob).replace('.', '')) | 80 | dat_dir, metric, str(coin_prob).replace('.', '')) |
74 | if xr is not None: | 81 | if xr is not None: |
75 | p.output = '{0}-zoom=1'.format(p.output) | 82 | p.output = '{0}-zoom=1'.format(p.output) |
76 | p.output = '{0}.pdf'.format(p.output) | ||
77 | |||
78 | p.format = 'pdf' | ||
79 | 83 | ||
80 | for (level, enforcement) in [(l, e) for l in ('c', 'b') for e in (1, 0)]: | 84 | for (level, enforcement) in [(l, e) for l in ('c', 'b') for e in (1, 0)]: |
81 | fname = '{0}/beta_be={1}_prob={2}.csv'.format(dat_dir, enforcement, coin_prob) | 85 | fname = '{0}/beta_be={1}_prob={2}.csv'.format(dat_dir, enforcement, coin_prob) |
@@ -88,7 +92,7 @@ def plot_metric(opts, dat_dir, metric, coin_prob, xr=None): | |||
88 | p.curves += [c] | 92 | p.curves += [c] |
89 | p.xlabel = 'beta mean with probability {0}'.format(coin_prob) | 93 | p.xlabel = 'beta mean with probability {0}'.format(coin_prob) |
90 | p.ylabel = get_y_label(metric) | 94 | p.ylabel = get_y_label(metric) |
91 | set_plot_opts(p) | 95 | set_plot_opts(opts, p) |
92 | if xr is not None: | 96 | if xr is not None: |
93 | p.xrange = xr | 97 | p.xrange = xr |
94 | 98 | ||