def plot(data, xlabel, ylabel, filename): opts = tsg_plot.PlotOptions() attribute_dict = { "plot_type": "line", "data": data, "labels": ["little", "big"], "legend_ncol": 2, "file_name": filename, "figsize": (3.5, 1.5), "fontsize": 8, "xlabel": xlabel, "ylabel": ylabel, "colors": [ tsg_plot.colors['blue3'][2], tsg_plot.colors['qualitative_paired'][5] ], "rotate_labels": True, "rotate_labels_angle": -30, } for k, v in attribute_dict.iteritems(): setattr(opts, k, v) tsg_plot.add_plot(opts)
def plot(data, filename): # Set up plotting options opts = tsg_plot.PlotOptions() # Benchmarks cat = data['benchmarks'] # Overheads subcat = data['policies'] opts.data = data['data'] opts.labels = [cat, subcat] attribute_dict = \ { 'plot_type' : 'bar', 'show' : False, 'file_name' : filename, 'paper_mode' : True, 'figsize' : (3.5, 2.0), 'ylabel' : 'Overhead Difference [%]', 'legend_ncol' : 6, 'legend_handlelength' : 1.0, 'legend_columnspacing' : 0.8, 'legend_handletextpad' : 0.5, 'legend_bbox' : [-0.05, 1.05, 1, 0.1], 'rotate_labels' : True, 'rotate_labels_angle' : -45, 'fontsize' : 8, 'bar_width' : 0.5, 'yrange' : [-50, 50], #'colors' : ['#deebf7', '#9acae1', '#3182bd', '#deebf7', '#9ecae1', '#3182bd'], 'colors' : ['#deebf7', '#3182bd'], } for name, value in attribute_dict.iteritems(): setattr(opts, name, value) # Plot tsg_plot.add_plot(opts)
def plot(data, labels): opts = tsg_plot.PlotOptions() opt_dict = \ { "data" : data, "labels" : labels, "plot_type" : "line", "figsize" : (7, 2.5), "fontsize" : 8, "file_name" : "plot_prediction.pdf", "symbols" : ['']*10, "legend_ncol" : 4, "xlabel" : "Job", "ylabel" : "Execution Time [us]", #"colors" : ["#000000", "#e31a1c"] "colors" : tsg_plot.colors["qualitative"], "linestyles" : ['-', '-', '--', '--'], } for k, v in opt_dict.iteritems(): setattr(opts, k, v) tsg_plot.add_plot(opts)
def plot(data): opts = tsg_plot.PlotOptions() opts.data = [] opts.labels = [[], []] opts.colors = [] color_keys = [] for (k, v) in data['data'].iteritems(): opts.data.append(v) opts.labels[1].append(k) # Use same colors based on key # color_key = k.split("_")[-2] # if not color_key in color_keys: # color_keys.append(color_key) # opts.colors.append(colors[color_keys.index(color_key)]) opts.colors = colors attribute_dict = \ { 'show' : False, 'file_name' : 'scatter.pdf', 'plot_type' : 'scatter', 'paper_mode' : True, 'figsize' : (7.0, 3.5), 'legend_ncol' : 3, 'ylabel' : 'Deadline Misses [%]', 'xlabel' : 'Energy [%]', 'fontsize' : 8, 'title' : '', #'yrange' : [0, 3], 'symbols' : ['o']*15 } for name, value in attribute_dict.iteritems(): setattr(opts, name, value) tsg_plot.add_plot(opts)
def plot_common(data, benchmarks, metrics, policies, filename): """ Common plot options. """ opts = tsg_plot.PlotOptions() attribute_dict = \ { 'figsize' : (5.8, 2.0), 'fontsize' : 8, 'num_rows' : 1, 'num_cols' : 2, 'labels' : [benchmarks, []], 'legend_ncol' : 6, 'legend_handlelength' : 1.0, 'legend_columnspacing' : 0.8, 'legend_handletextpad' : 0.5, 'legend_bbox' : [0.05, 1.10, 2., 0.1], 'rotate_labels' : True, 'rotate_labels_angle' : -30, } for k, v in attribute_dict.iteritems(): setattr(opts, k, v) return opts
#!/usr/bin/env python import sys from pylab import * from parse_lib import * from dvfs_sim_lib import * import tsg_plot import numpy if len(sys.argv) == 2: filename = sys.argv[1] else: print "usage: graph_metrics.py filename" sys.exit() opts = tsg_plot.PlotOptions() # Common options for plots attribute_dict = \ { 'colors' : ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99", "#b15928", "#fdbf6f"], 'bar_width' : 0.7, 'figsize' : (7.0, 3.0), 'fontsize' : 10, 'legend_ncol' : 2, 'legend_bbox': (0.0, 1.1, 1.0, 0.1), 'file_name' : 'plot_metrics.pdf', 'rotate_labels' : True, 'rotate_labels_angle' : -45, 'xlabel' : '', 'title' : '', 'show' : False,