def main(): output_graph = sys.argv[1] plot = Plot() plot.hasLegend(location='lower right') plot.xLabel = 'Per-client throughput (Mbps)' # Change this plot.yLabel = 'CDF' plot.xLimits = (0, 50) plot.yLimits = (0, 1) plot.legendLabelSize = FONT_SIZE plot.xTickLabelSize = FONT_SIZE - 2 plot.yTickLabelSize = FONT_SIZE - 2 plot.axesLabelSize = FONT_SIZE for csv_file in sys.argv[2:]: cdf_table = _make_cdf(csv_file) line = Line() line.xValues = [x for (x, _) in cdf_table] line.yValues = [y for (_, y) in cdf_table] line.color = colors.pop(0) line.lineStyle = line_styles.pop(0) # Extract the filename line.label = capitalize( csv_file.split('/')[-2].replace('.csv', '') ) plot.add(line) plot.save(output_graph)
def constructImage(self): line1 = Line() line1.xValues = range(7) line1.yValues = [1, 2, 4, 8, 16, 32, 64] line1.label = "First Plot" line1.lineStyle = "-" line1.color = "red" line2 = Line() line2.xValues = range(7) line2.yValues = [100, 90, 80, 70, 60, 50, 40] line2.label = "Second Plot" line2.lineStyle = "--" line2.color = "blue" plot = Plot() plot.add(line1) plot.add(line2) plot.xLabel = "Shared X Axis" plot.yLabel = "First Plot's Y Axis" plot.setTwinX("Second Plot's Y Axis", 1) plot.hasLegend() plot.save(self.imageName)
#!/usr/bin/env python from boomslang import Line, Plot line1 = Line() line1.xValues = range(7) line1.yValues = [1, 2, 4, 8, 16, 32, 64] line1.label = "First Plot" line1.lineStyle = "-" line1.color = "red" line2 = Line() line2.xValues = range(7) line2.yValues = [100, 90, 80, 70, 60, 50, 40] line2.label = "Second Plot" line2.lineStyle = "--" line2.color = "blue" plot = Plot() plot.add(line1) plot.add(line2) plot.setXLabel("Shared X Axis") plot.setYLabel("First Plot's Y Axis") plot.setTwinX("Second Plot's Y Axis", 1) plot.hasLegend() plot.save("twinx.png")