Example #1
0
def plot_results(frame, save=True, plot_prefix=None, dirname='./'):
    # generate each type of plot
    filter_join = lambda join_with, list: join_with.join(filter(None, list))
    for vary_what in ['rows', 'cols', 'clusters', 'views']:
        plot_filename = filter_join('_', [plot_prefix, 'vary', vary_what])
        _plot_results(frame, vary_what, plot_filename)
        if save:
            pu.savefig_legend_outside(plot_filename, dir=dirname)
            pass
        pass
    return
Example #2
0
def plot_grouped_data(dict_of_dicts, plot_parameters, plot_filename=None):
    get_color_parameter = plot_parameters['get_color_parameter']
    color_dict = plot_parameters['color_dict']
    color_label_prepend = plot_parameters['color_label_prepend']
    timing_row_to_color = lambda timing_row: \
        color_dict[get_color_parameter(timing_row)]
    get_marker_parameter = plot_parameters['get_marker_parameter']
    marker_dict = plot_parameters['marker_dict']
    marker_label_prepend = plot_parameters['marker_label_prepend']
    timing_row_to_marker = lambda timing_row: \
        marker_dict[get_marker_parameter(timing_row)]
    vary_what = plot_parameters['vary_what']
    which_kernel = plot_parameters['which_kernel']
    #
    fh = pylab.figure()
    for configuration, run_data in dict_of_dicts.iteritems():
        x = sorted(run_data.keys())
        _y = [run_data[el] for el in x]
        y = map(get_time_per_step, _y)
        #
        plot_args = dict()
        first_timing_row = run_data.values()[0]
        color = timing_row_to_color(first_timing_row)
        plot_args['color'] = color
        marker = timing_row_to_marker(first_timing_row)
        plot_args['marker'] = marker
        label = str(configuration)
        plot_args['label'] = label
        #
        pylab.plot(x, y, **plot_args)
    #
    pylab.xlabel('# %s' % vary_what)
    pylab.ylabel('time per step (seconds)')
    pylab.title('Timing analysis for kernel: %s' % which_kernel)

    # pu.legend_outside(bbox_to_anchor=(0.5, -.1), ncol=4, label_cmp=label_cmp)
    pu.legend_outside_from_dicts(marker_dict,
                                 color_dict,
                                 marker_label_prepend=marker_label_prepend,
                                 color_label_prepend=color_label_prepend,
                                 bbox_to_anchor=(0.5, -.1),
                                 label_cmp=label_cmp)

    if plot_filename is not None:
        pu.savefig_legend_outside(plot_filename)
    else:
        pylab.ion()
        pylab.show()
    return fh
def plot_grouped_data(dict_of_dicts, plot_parameters, plot_filename=None):
    get_color_parameter = plot_parameters['get_color_parameter']
    color_dict = plot_parameters['color_dict']
    color_label_prepend = plot_parameters['color_label_prepend']
    timing_row_to_color = lambda timing_row: \
        color_dict[get_color_parameter(timing_row)]
    get_marker_parameter = plot_parameters['get_marker_parameter']
    marker_dict = plot_parameters['marker_dict']
    marker_label_prepend = plot_parameters['marker_label_prepend']
    timing_row_to_marker = lambda timing_row: \
        marker_dict[get_marker_parameter(timing_row)]
    vary_what = plot_parameters['vary_what']
    which_kernel = plot_parameters['which_kernel']
    #
    fh = pylab.figure()
    for configuration, run_data in dict_of_dicts.iteritems():
        x = sorted(run_data.keys())
        _y = [run_data[el] for el in x]
        y = map(get_time_per_step, _y)
        #
        plot_args = dict()
        first_timing_row = run_data.values()[0]
        color = timing_row_to_color(first_timing_row)
        plot_args['color'] = color
        marker = timing_row_to_marker(first_timing_row)
        plot_args['marker'] = marker
        label = str(configuration)
        plot_args['label'] = label
        #
        pylab.plot(x, y, **plot_args)
    #
    pylab.xlabel('# %s' % vary_what)
    pylab.ylabel('time per step (seconds)')
    pylab.title('Timing analysis for kernel: %s' % which_kernel)

    # pu.legend_outside(bbox_to_anchor=(0.5, -.1), ncol=4, label_cmp=label_cmp)
    pu.legend_outside_from_dicts(marker_dict, color_dict,
                                 marker_label_prepend=marker_label_prepend, color_label_prepend=color_label_prepend,
                                 bbox_to_anchor=(0.5, -.1), label_cmp=label_cmp)
                                 
                                 

    if plot_filename is not None:
        pu.savefig_legend_outside(plot_filename)
    else:
        pylab.ion()
        pylab.show()
    return fh