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)
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)
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 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): 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)
#!/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)
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" bar3.label = "3 Threads" bar4 = Bar() bar4.xValues = threadsData["4"][0]
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")