Exemple #1
0
    def constructImage(self):
        plot = Plot()

        bar = Bar()
        bar.xValues = range(5)
        bar.yValues = [2, 8, 4, 6, 5]

        plot.add(bar)
        plot.xLabel = "Widget ID"
        plot.yLabel = "# Widgets Sold"

        plot.save(self.imageName)
Exemple #2
0
    def constructImage(self):
        plot = BrokenAxisPlot(break_points=(4,8))

        bar = Bar()
        bar.xValues = range(5)
        bar.yValues = [2, 12, 3, 18.5, 13]

        plot.add(bar)
        plot.setXLabel("Widget ID")
        plot.setYLabel("# Widgets Sold")

        plot.save(self.imageName)
Exemple #3
0
    def constructImage(self):
        line = Line()
        line.xValues = range(5)
        line.yValues = [2, 4, 6, 8, 10]

        linePlot = Plot()
        linePlot.add(line)
        linePlot.setXLabel("X Data")
        linePlot.setYLabel("Y Data")
        linePlot.setTitle("Data as Line")

        bar = Bar()
        bar.xValues = range(5)
        bar.yValues = [2, 4, 6, 8, 10]

        barPlot = Plot()

        barPlot.add(bar)
        barPlot.setXLabel("X Data")
        barPlot.setYLabel("Y Data")
        barPlot.setTitle("Data as Bars")

        scatter = Scatter()
        scatter.xValues = range(5)
        scatter.yValues = [2, 4, 6, 8, 10]

        scatterPlot = Plot()
        scatterPlot.add(scatter)
        scatterPlot.setXLabel("X Data")
        scatterPlot.setYLabel("Y Data")
        scatterPlot.setTitle("Data as Points")


        layout = PlotLayout()
        # Plots in the same grouping are placed together on the same line
        layout.addPlot(linePlot, grouping="topRow")
        layout.addPlot(barPlot, grouping="topRow")

        # Plots without a grouping are arranged as follows:

        # * While you can make a row of N plots, where N is the size of the plot
        # grouping with the largest size, do so.

        # * If you can't make a row of N plots, make the plots stretch across a
        # single row.

        layout.addPlot(scatterPlot)

        # Set values similar to those given in the "Configure subplots" sliders
        # in the interactive figure
        layout.setPlotParameters(hspace=0.48)
        layout.save(self.imageName)
Exemple #4
0
def getBinBars(rows,
               binKey,
               quantityKey,
               xLabelFormattingFunction,
               xLabel,
               yLabel,
               xLabelRotation=0):
    bins = []
    countsPerBin = []

    for row in rows:
        bins.append(int(row[binKey]))
        countsPerBin.append(int(row[quantityKey]))

    bar = Bar()
    bar.xValues = bins
    bar.yValues = countsPerBin

    if xLabelFormattingFunction is not None:
        bar.xTickLabelPoints = range(len(bins))
        bar.xTickLabels = map(xLabelFormattingFunction, bar.xTickLabelPoints)

    if xLabelRotation > 0:
        bar.setXTickLabelProperties(rotation=str(xLabelRotation))

    barPlot = Plot()
    barPlot.add(bar)
    barPlot.setXLabel(xLabel)
    barPlot.setYLabel(yLabel)
    #    barPlot.setXLimits(0, None)
    return barPlot
    def constructImage(self):
        cluster = ClusteredBars()

        colors = ['red','green','blue','CornflowerBlue','LightSalmon']

        yVals = [[
            [1, 3, 2, 5, 4],
            [2, 2, 2, 2, 2],
            [1, 3, 2, 4, 3],
            [0, 4, 0, 4, 0],
            [5, 5, 5, 5, 5]
        ],[
            [2, 2, 2, 2, 2],
            [2, 2, 2, 2, 2],
            [2, 2, 2, 2, 2],
            [2, 2, 2, 2, 2],
            [2, 2, 2, 2, 2]
        ],
        [
            [1, 3, 1, 3, 1],
            [1, 3, 1, 3, 1],
            [1, 3, 1, 3, 1],
            [1, 3, 1, 3, 1],
            [1, 3, 1, 3, 1],
        ]]

        for i in xrange(3):
            stack = StackedBars()

            for j in xrange(5):
                bar = Bar()
                bar.xValues = range(5)
                bar.yValues = yVals[i][j]
                bar.color = colors[j]
                bar.label = "Subject %d" % (j+1,)

                stack.add(bar)
            cluster.add(stack)

        cluster.spacing = 0.5
        cluster.xTickLabels = ["1", "2", "3", "4", "5"]

        plot = Plot()
        plot.add(cluster)
        plot.hasLegend()
        plot.setXLabel('Nested Cars')
        plot.setYLabel('Party (lampshades)')
        plot.save(self.imageName)
    def constructImage(self):
        line = Line()
        line.xValues = range(5)
        line.yValues = [2, 4, 6, 8, 10]

        linePlot = Plot()
        linePlot.add(line)
        linePlot.xLabel = "X Data"
        linePlot.yLabel = "Y Data"
        linePlot.title = "Data as Line"

        bar = Bar()
        bar.xValues = range(5)
        bar.yValues = [2, 4, 6, 8, 10]

        barPlot = Plot()

        barPlot.add(bar)
        barPlot.xLabel = "X Data"
        barPlot.yLabel = "Y Data"
        barPlot.title = "Data as Bars"

        scatter = Scatter()
        scatter.xValues = range(5)
        scatter.yValues = [2, 4, 6, 8, 10]

        scatterPlot = Plot()
        scatterPlot.add(scatter)
        scatterPlot.xLabel = "X Data"
        scatterPlot.yLabel = "Y Data"
        scatterPlot.title = "Data as Points"

        layout = WeightedPlotLayout()
        # Plots in the same grouping are placed together on the same line
        layout.addPlot(linePlot, grouping="topRow", weight=2)
        layout.addPlot(barPlot, grouping="topRow")

        # Plots without a grouping are arranged as follows:

        # * While you can make a row of N plots, where N is the size of the plot
        # grouping with the largest size, do so.

        # * If you can't make a row of N plots, make the plots stretch across a
        # single row.

        layout.addPlot(scatterPlot)

        layout.save(self.imageName)
Exemple #7
0
    def constructImage(self):
        line = Line()
        line.xValues = range(5)
        line.yValues = [2, 4, 6, 8, 10]

        linePlot = Plot()
        linePlot.add(line)
        linePlot.xLabel = "X Data"
        linePlot.yLabel = "Y Data"
        linePlot.title = "Data as Line"

        bar = Bar()
        bar.xValues = range(5)
        bar.yValues = [2, 4, 6, 8, 10]

        barPlot = Plot()

        barPlot.add(bar)
        barPlot.xLabel = "X Data"
        barPlot.yLabel = "Y Data"
        barPlot.title = "Data as Bars"

        scatter = Scatter()
        scatter.xValues = range(5)
        scatter.yValues = [2, 4, 6, 8, 10]

        scatterPlot = Plot()
        scatterPlot.add(scatter)
        scatterPlot.xLabel = "X Data"
        scatterPlot.yLabel = "Y Data"
        scatterPlot.title = "Data as Points"

        layout = PlotLayout()

        layout.addPlot(linePlot, grouping="topRow")
        layout.addPlot(barPlot, grouping="topRow")

        layout.addPlot(scatterPlot)

        layout.save(self.imageName)
Exemple #8
0
    def constructImage(self):
        line = Line()
        line.xValues = range(5)
        line.yValues = [2, 4, 6, 8, 10]

        linePlot = Plot()
        linePlot.add(line)
        linePlot.xLabel = "X Data"
        linePlot.yLabel = "Y Data"
        linePlot.title = "Data as Line"

        bar = Bar()
        bar.xValues = range(5)
        bar.yValues = [2, 4, 6, 8, 10]

        barPlot = Plot()

        barPlot.add(bar)
        barPlot.xLabel = "X Data"
        barPlot.yLabel = "Y Data"
        barPlot.title = "Data as Bars"

        scatter = Scatter()
        scatter.xValues = range(5)
        scatter.yValues = [2, 4, 6, 8, 10]

        scatterPlot = Plot()
        scatterPlot.add(scatter)
        scatterPlot.xLabel = "X Data"
        scatterPlot.yLabel = "Y Data"
        scatterPlot.title = "Data as Points"

        layout = PlotLayout()

        layout.addPlot(linePlot, grouping="topRow")
        layout.addPlot(barPlot, grouping="topRow")

        layout.addPlot(scatterPlot)

        layout.save(self.imageName)
    def constructImage(self):
        bar = Bar()

        bar.xValues = range(5)
        bar.yValues = [2, 4, 6, 8, 10]
        # Valid values include all marker types, /, //, \, \\
        bar.hatch = r"\\"
        bar.color="red"
        bar.edgeColor="black"

        plot = Plot()
        plot.add(bar)
        plot.save(self.imageName)
    def constructImage(self):
        cluster = ClusteredBars()

        colors = ['red', 'green', 'blue', 'CornflowerBlue', 'LightSalmon']

        yVals = [[[1, 3, 2, 5, 4], [2, 2, 2, 2, 2], [1, 3, 2, 4, 3],
                  [0, 4, 0, 4, 0], [5, 5, 5, 5, 5]],
                 [[2, 2, 2, 2, 2], [2, 2, 2, 2, 2], [2, 2, 2, 2, 2],
                  [2, 2, 2, 2, 2], [2, 2, 2, 2, 2]],
                 [
                     [1, 3, 1, 3, 1],
                     [1, 3, 1, 3, 1],
                     [1, 3, 1, 3, 1],
                     [1, 3, 1, 3, 1],
                     [1, 3, 1, 3, 1],
                 ]]

        for i in xrange(3):
            stack = StackedBars()

            for j in xrange(5):
                bar = Bar()
                bar.xValues = range(5)
                bar.yValues = yVals[i][j]
                bar.color = colors[j]
                bar.label = "Subject %d" % (j + 1, )

                stack.add(bar)
            cluster.add(stack)

        cluster.spacing = 0.5
        cluster.xTickLabels = ["1", "2", "3", "4", "5"]

        plot = Plot()
        plot.add(cluster)
        plot.hasLegend()
        plot.setXLabel('Nested Cars')
        plot.setYLabel('Party (lampshades)')
        plot.save(self.imageName)
def plot_timeline_for_phase(log_directory, job, phase, phase_data):
    min_timestamp = phase_data["min_timestamp"]
    max_timestamp = phase_data["max_timestamp"]

    description = Description(os.path.join(log_directory, job, "description"))
    stage_ordering = description.getStageOrdering(phase)

    duration_lists = {}

    for stage in stage_ordering:
        duration_lists[stage] = []

    for key in phase_data:
        if key in ["min_timestamp", "max_timestamp"]:
            continue

        hostname, stage, worker_id = key

        worker_duration_info = Duration(
            hostname.split('.')[0], stage, worker_id,
            (phase_data[key][0] - min_timestamp) / 1000000.0,
            (phase_data[key][1] - min_timestamp) / 1000000.0)

        duration_lists[stage].append(worker_duration_info)

    def sort_function(x):
        return (x.hostname, x.worker_id, x.start_time, x.stop_time)

    layout = PlotLayout()

    for stage in stage_ordering:
        duration_list = duration_lists[stage]

        duration_list.sort(key=sort_function)

        bars = {}

        # Set up a "padding" bar that will appear to move bars up so that they
        # start when the worker starts
        start_bar = Bar()
        start_bar.linewidth = 0
        start_bar.color = "white"

        for i, duration in enumerate(duration_list):
            if duration.hostname not in bars:
                bars[duration.hostname] = Bar()

            bars[duration.hostname].yValues.append(duration.stop_time -
                                                   duration.start_time)
            start_bar.yValues.append(duration.start_time)

        # Make sure that all bars have the same number of y-axis values,
        # give them x-axis values and set their colors

        start_bar.xValues = range(len(start_bar.yValues))
        start_bar.xTickLabelProperties = {"rotation": 90}

        bar_colors = [
            "red", "blue", "green", "orange", "gray", "pink", "purple", "black"
        ]

        offset = 0

        for i, (hostname, bar) in enumerate(bars.items()):
            # Pad y axis with zeroes so that bars can be laid out next to
            # each other with a StackedBars
            num_y_values = len(bar.yValues)

            bar.yValues = (([0] * offset) + bar.yValues +
                           ([0] * (len(duration_list) -
                                   (num_y_values + offset))))

            # Put the label for this hostname roughly in the middle of its bar
            # cluster
            start_bar.xTickLabels.append(hostname)
            # Subtracting 0.5 to account for half the width of the bar
            start_bar.xTickLabelPoints.append(offset + (num_y_values / 2.0) -
                                              0.5)

            offset += num_y_values

            bar.xValues = range(len(bar.yValues))
            bar.color = bar_colors[i % len(bar_colors)]
            bar.label = hostname

        stacked_bars = StackedBars()
        stacked_bars.add(start_bar)

        for hostname in sorted(bars.keys()):
            stacked_bars.add(bars[hostname])

        plot = Plot()
        plot.setYLimits(0,
                        ((max_timestamp - min_timestamp) / 1000000.0) * 1.05)
        plot.setXLabel("Worker")
        plot.setYLabel("Time (s)")
        plot.setTitle(stage)

        plot.add(stacked_bars)
        layout.addPlot(plot)

    return layout
    threadsData["8"] = [[], []]

    try:
        while True:
            row1 = data.next()
            row2 = data.next()
            row3 = data.next()

            x = int(row1[" K"]) / 20
            y = (float(row1[" PforMSWpS"]) + float(row2[" PforMSWpS"]) + float(row3[" PforMSWpS"])) / 3.0
            threadsData[row1[" THREADS"].strip()][0].append(x)
            threadsData[row1[" THREADS"].strip()][1].append(y)

    except:
        pass
    bar1 = Bar()
    bar1.xValues = threadsData["1"][0]
    bar1.yValues = threadsData["1"][1]
    bar1.color = "red"
    bar1.label = "1 Thread"

    bar2 = Bar()
    bar2.xValues = threadsData["2"][0]
    bar2.yValues = threadsData["2"][1]
    bar2.color = "blue"
    bar2.label = "2 Threads"

    bar3 = Bar()
    bar3.xValues = threadsData["3"][0]
    bar3.yValues = threadsData["3"][1]
    bar3.color = "green"
Exemple #13
0
    def constructImage(self):
        bar1 = Bar()
        bar1.xValues = range(5)
        bar1.yValues = [1, 2, 1, 2, 3]
        bar1.color = "red"
        bar1.label = "Red Cluster"

        bar2 = Bar()
        bar2.xValues = range(5)
        bar2.yValues = [2, 2, 3, 3, 4]
        bar2.color = "blue"
        bar2.label = "Blue Cluster"

        bar3 = Bar()
        bar3.xValues = range(5)
        bar3.yValues = [3, 5, 4, 5, 3]
        bar3.color = "green"
        bar3.label = "Green Cluster"

        stackedBars = StackedBars()
        stackedBars.add(bar1)
        stackedBars.add(bar2)
        stackedBars.add(bar3)

        stackedBars.xTickLabels = ["A", "B", "C", "D", "E"]

        plot = Plot()
        plot.add(stackedBars)
        plot.setYLimits(0, 15)
        plot.hasLegend()
        plot.save(self.imageName)
Exemple #14
0
#!/usr/bin/env python

from boomslang import Bar, Line, Scatter, Plot, PlotLayout

line = Line()
line.xValues = range(5)
line.yValues = [2, 4, 6, 8, 10]

linePlot = Plot()
linePlot.add(line)
linePlot.setXLabel("X Data")
linePlot.setYLabel("Y Data")
linePlot.setTitle("Data as Line")

bar = Bar()
bar.xValues = range(5)
bar.yValues = [2, 4, 6, 8, 10]

barPlot = Plot()

barPlot.add(bar)
barPlot.setXLabel("X Data")
barPlot.setYLabel("Y Data")
barPlot.setTitle("Data as Bars")

scatter = Scatter()
scatter.xValues = range(5)
scatter.yValues = [2, 4, 6, 8, 10]

scatterPlot = Plot()
scatterPlot.add(scatter)
        dataY.append(y)
        y = (float(row1[' OptWpS']) + float(row2[' OptWpS']) + float(row3[' OptWpS'])) / 3.0
        dataY.append(y)
        y = (float(row1[' Opt2WpS']) + float(row2[' Opt2WpS']) + float(row3[' Opt2WpS'])) / 3.0
        dataY.append(y)

    except:
        pass


    bars = []
    labels = ['Reference', 'OMP - For', 'OMP - Tasks', 'Comp-Opt', 'Manual-Opt']
    colors = ['yellow', 'red', 'orange', 'blue', 'green']
    index = 0
    for y in dataY:
        bar = Bar()
        bar.xValues = [index]
        bar.yValues = [y]
        bar.color =  colors[index]
        bar.label = labels[index]
        index += 1
        bars.append(bar)

    plot = Plot()
    for bar in bars:
        plot.add(bar)
    plot.setXLabel("Versions")
    plot.setYLabel("WpS")
    plot.hasLegend()

    plot.save("seq.png")
Exemple #16
0
#!/usr/bin/env python
from boomslang import StackedBars, Bar, Plot

bar1 = Bar()
bar1.xValues = range(5)
bar1.yValues = [1, 2, 1, 2, 3]
bar1.color = "red"
bar1.label = "Red Cluster"

bar2 = Bar()
bar2.xValues = range(5)
bar2.yValues = [2, 2, 3, 3, 4]
bar2.color = "blue"
bar2.label = "Blue Cluster"

bar3 = Bar()
bar3.xValues = range(5)
bar3.yValues = [3, 5, 4, 5, 3]
bar3.color = "green"
bar3.label = "Green Cluster"

stackedBars = StackedBars()
stackedBars.add(bar1)
stackedBars.add(bar2)
stackedBars.add(bar3)

stackedBars.xTickLabels = ["A", "B", "C", "D", "E"]

plot = Plot()
plot.add(stackedBars)
plot.setYLimits(0, 15)
Exemple #17
0
    def constructImage(self):
        bar1 = Bar()
        bar1.xValues = range(5)
        bar1.yValues = [2, 4, 6, 8, 10]
        bar1.color = "red"
        bar1.label = "Red Cluster"

        bar2 = Bar()
        bar2.xValues = range(5)
        bar2.yValues = [3, 12, 4, 8, 14]
        bar2.color = "blue"
        bar2.label = "Blue Cluster"

        bar3 = Bar()
        bar3.xValues = range(5)
        bar3.yValues = [1, 6, 9, 13, 20]
        bar3.color = "green"
        bar3.label = "Green Cluster"

        clusteredBars = ClusteredBars()

        clusteredBars.add(bar1)
        clusteredBars.add(bar2)
        clusteredBars.add(bar3)
        clusteredBars.spacing = 0.5

        clusteredBars.xTickLabels = ["A", "B", "C", "D", "E"]

        plot = Plot()
        plot.add(clusteredBars)
        plot.hasLegend()

        plot.save(self.imageName)
Exemple #18
0
#!/usr/bin/env python

from boomslang import Bar, Plot

bar = Bar()

bar.xValues = range(5)
bar.yValues = [2, 4, 6, 8, 10]
# Valid values include all marker types, /, //, \, \\
bar.hatch = r"\\"
bar.color="red"
bar.edgeColor="black"

plot = Plot()
plot.add(bar)
plot.save("hatchedbars.png")
Exemple #19
0
#!/usr/bin/env python

from boomslang import Bar, Plot

plot = Plot()

bar = Bar()
bar.xValues = range(5)
bar.yValues = [2, 8, 4, 6, 5]

plot.add(bar)
plot.setXLabel("Widget ID")
plot.setYLabel("# Widgets Sold")

plot.save("bar.png")
Exemple #20
0
    def constructImage(self):
        bar1 = Bar()
        bar1.xValues = range(5)
        bar1.yValues = [1, 2, 1, 2, 3]
        bar1.color = "red"
        bar1.label = "Red Cluster"

        bar2 = Bar()
        bar2.xValues = range(5)
        bar2.yValues = [2, 2, 3, 3, 4]
        bar2.color = "blue"
        bar2.label = "Blue Cluster"

        bar3 = Bar()
        bar3.xValues = range(5)
        bar3.yValues = [3, 5, 4, 5, 3]
        bar3.color = "green"
        bar3.label = "Green Cluster"

        stackedBars = StackedBars()
        stackedBars.add(bar1)
        stackedBars.add(bar2)
        stackedBars.add(bar3)

        stackedBars.xTickLabels = ["A", "B", "C", "D", "E"]

        plot = Plot()
        plot.add(stackedBars)
        plot.yLimits = (0, 15)
        plot.hasLegend()
        plot.save(self.imageName)
def plot_timeline_for_phase(log_directory, job, phase, phase_data):
    min_timestamp = phase_data["min_timestamp"]
    max_timestamp = phase_data["max_timestamp"]

    description = Description(os.path.join(log_directory, job, "description"))
    stage_ordering = description.getStageOrdering(phase)

    duration_lists = {}

    for stage in stage_ordering:
        duration_lists[stage] = []

    for key in phase_data:
        if key in ["min_timestamp", "max_timestamp"]:
            continue

        hostname, stage, worker_id = key

        worker_duration_info = Duration(
            hostname.split('.')[0], stage, worker_id,
            (phase_data[key][0] - min_timestamp) / 1000000.0,
            (phase_data[key][1] - min_timestamp) / 1000000.0)

        duration_lists[stage].append(worker_duration_info)

    def sort_function(x):
        return (x.hostname, x.worker_id, x.start_time, x.stop_time)

    layout = PlotLayout()

    for stage in stage_ordering:
        duration_list = duration_lists[stage]

        duration_list.sort(key=sort_function)

        bars = {}

        # Set up a "padding" bar that will appear to move bars up so that they
        # start when the worker starts
        start_bar = Bar()
        start_bar.linewidth = 0
        start_bar.color = "white"

        for i, duration in enumerate(duration_list):
            if duration.hostname not in bars:
                bars[duration.hostname] = Bar()

            bars[duration.hostname].yValues.append(
                duration.stop_time - duration.start_time)
            start_bar.yValues.append(duration.start_time)

        # Make sure that all bars have the same number of y-axis values,
        # give them x-axis values and set their colors

        start_bar.xValues = range(len(start_bar.yValues))
        start_bar.xTickLabelProperties = {
            "rotation" : 90
            }

        bar_colors = ["red", "blue", "green", "orange", "gray", "pink",
                      "purple", "black"]

        offset = 0

        for i, (hostname, bar) in enumerate(bars.items()):
            # Pad y axis with zeroes so that bars can be laid out next to
            # each other with a StackedBars
            num_y_values = len(bar.yValues)

            bar.yValues = (([0] * offset) + bar.yValues +
                           ([0] *
                            (len(duration_list) - (num_y_values + offset))))

            # Put the label for this hostname roughly in the middle of its bar
            # cluster
            start_bar.xTickLabels.append(hostname)
            # Subtracting 0.5 to account for half the width of the bar
            start_bar.xTickLabelPoints.append(offset + (num_y_values / 2.0)
                                              - 0.5)

            offset += num_y_values

            bar.xValues = range(len(bar.yValues))
            bar.color = bar_colors[i % len(bar_colors)]
            bar.label = hostname

        stacked_bars = StackedBars()
        stacked_bars.add(start_bar)

        for hostname in sorted(bars.keys()):
            stacked_bars.add(bars[hostname])

        plot = Plot()
        plot.setYLimits(0, ((max_timestamp - min_timestamp) / 1000000.0) * 1.05)
        plot.setXLabel("Worker")
        plot.setYLabel("Time (s)")
        plot.setTitle(stage)

        plot.add(stacked_bars)
        layout.addPlot(plot)

    return layout