From 6469f7be7b5edf73b9ecd8d498199961a8be3dd9 Mon Sep 17 00:00:00 2001 From: Christopher Kenna Date: Tue, 18 Oct 2011 22:24:51 -0400 Subject: add png format, too --- plot_rtas12_betaexp.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'plot_rtas12_betaexp.py') 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): return LABELS[metric] -def set_plot_opts(p): +def set_plot_opts(opts, p): p.rounded_caps = True p.font = 'Helvetica' - p.font_size = '5pt' - p.size = ('8.5cm', '5.25cm') + if opts.paper: + ext = 'pdf' + p.size = ('8.5cm', '5.25cm') + p.font_size = '5pt' + else: + ext = 'png' + p.size = (1024, 768) + p.output = '{0}.{1}'.format(p.output, ext) + p.format = ext p.default_style = 'linespoints lw 2.5' p.default_style += ' smooth bezier' p.monochrome = False @@ -66,16 +73,13 @@ def plot_metric(opts, dat_dir, metric, coin_prob, xr=None): """Plot metric for each level, enforcement pair at the specified probability. - .""" + """ # each coin value gets a plot p = Plot() p.output = '{0}/beta-exp-metric={1}-prob={2}'.format( dat_dir, metric, str(coin_prob).replace('.', '')) if xr is not None: p.output = '{0}-zoom=1'.format(p.output) - p.output = '{0}.pdf'.format(p.output) - - p.format = 'pdf' for (level, enforcement) in [(l, e) for l in ('c', 'b') for e in (1, 0)]: 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): p.curves += [c] p.xlabel = 'beta mean with probability {0}'.format(coin_prob) p.ylabel = get_y_label(metric) - set_plot_opts(p) + set_plot_opts(opts, p) if xr is not None: p.xrange = xr -- cgit v1.2.2