本文整理汇总了Python中boomslang.Plot.add方法的典型用法代码示例。如果您正苦于以下问题:Python Plot.add方法的具体用法?Python Plot.add怎么用?Python Plot.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boomslang.Plot
的用法示例。
在下文中一共展示了Plot.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
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)
示例2: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
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)
示例3: histogram_plot
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
def histogram_plot(experiment_log_dir, plot_spec_string, output_filename,
has_legend, x_limit, verbose):
queries = [
plot_utils.plot_spec_string_to_query(plot_spec_string, 0, "HIST")]
plot_data = metaprogram_utils.process_queries(
queries, experiment_log_dir, verbose)
if "plot_points" not in plot_data:
warnings.warn("No data to plot!")
return
histogram_data = plot_data["plot_points"][0]
cumulative_histogram = {}
layout = PlotLayout()
layout.dpi = 250
for stat_name in histogram_data:
plot = Plot()
plot.setTitle(stat_name)
if has_legend:
plot.hasLegend(labelSize=8)
if x_limit is not None:
plot.setXLimits(0, x_limit)
style_plot(plot, stat_name)
for key, points in sorted(histogram_data[stat_name].items()):
for size, count in itertools.izip(points["bin"], points["count"]):
if size not in cumulative_histogram:
cumulative_histogram[size] = 0
cumulative_histogram[size] += count
line = Line()
line.stepFunction("pre")
line.label = str(key)
line.xValues = points["bin"]
line.yValues = points["count"]
plot.add(line)
layout.addPlot(plot)
cumulative_plot = Plot()
if x_limit is not None:
cumulative_plot.setXLimits(0, x_limit)
cumulative_plot.setTitle("Cumulative Histogram for " + stat_name)
style_plot(cumulative_plot, stat_name)
line = Line()
line.stepFunction("pre")
line.xValues = sorted(cumulative_histogram.keys())
line.yValues = [cumulative_histogram[key] for key in line.xValues]
cumulative_plot.add(line)
layout.addPlot(cumulative_plot)
layout.save(output_filename)
示例4: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
def constructImage(self):
plot = Plot()
# Uneven error bars
line = Line()
line.xValues = [6,10,4,0,8,2,12]
line.yValues = [50,90,30,10,70,20,110]
line.yMins = [y - 30 for y in line.yValues]
line.yMaxes = [y + 50 for y in line.yValues]
line.label = "Asymmetric Errors"
line.color = "red"
# Even error bars
line2 = Line()
line2.xValues = [1,5,3,9,7,11]
line2.yValues = [100, 120, 110, 140, 130, 150]
line2.color = "blue"
line2.label = "Symmetric Errors"
line2.yErrors = [5,25,15,45,35,55]
plot.add(line)
plot.add(line2)
plot.xLabel = "X Label"
plot.yLabel = "Y Label"
plot.hasLegend()
plot.xLimits = (-1, 13)
plot.save(self.imageName)
示例5: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
def constructImage(self):
layout = PlotLayout()
plotBase10 = Plot()
plotBase10.loglog = True
lineBase10 = Line()
lineBase10.marker = 'x'
lineBase10.xValues = [1, 10, 100, 1000, 10000]
lineBase10.yValues = [1, 25, 140, 1024, 10342]
plotBase10.add(lineBase10)
plotBase2 = Plot()
plotBase2.logx = True
plotBase2.logbase = 2
lineBase2 = Line()
lineBase2.marker = 'x'
lineBase2.xValues = [1, 2, 4, 8, 16, 32, 64]
lineBase2.yValues = [1, 2, 3, 4, 5, 6, 7]
plotBase2.add(lineBase2)
layout.addPlot(plotBase10)
layout.addPlot(plotBase2)
layout.width = 2
layout.save(self.imageName)
示例6: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
def constructImage(self):
scatter = Scatter()
scatter.label="Hooray dots with vlines!"
scatter.xValues = [
7, 6, 3, 5, 7, 6, 1, 1, 6, 5, 8, 6, 7, 8, 0, 2, 9, 3, 9,
5, 4, 5, 0, 0, 2, 3, 1, 4, 1, 3, 3, 8, 1, 5, 2, 6, 0, 3,
5, 1, 4, 9, 5, 1, 9, 9, 9, 7, 6, 5, 8, 6, 0, 2, 6, 9, 2,
5, 6, 9, 7, 8, 7, 6, 5, 9, 9, 2, 4, 9, 0, 1, 1, 1, 6, 4,
5, 8, 9, 1, 2, 1, 4, 5, 9, 7, 4, 9, 2, 9, 2, 5, 2, 2, 0,
2, 1, 9, 3, 6]
scatter.yValues = [
2, 5, 9, 5, 9, 3, 6, 1, 6, 0, 0, 6, 2, 5, 3, 9, 2, 7, 6,
2, 3, 1, 9, 9, 5, 2, 9, 0, 2, 3, 0, 2, 5, 5, 8, 4, 1, 9,
8, 6, 1, 6, 9, 2, 4, 9, 2, 8, 1, 1, 2, 1, 0, 6, 3, 4, 2,
5, 6, 8, 6, 9, 0, 6, 8, 6, 8, 1, 6, 2, 2, 3, 6, 2, 2, 2,
0, 2, 4, 6, 8, 5, 1, 4, 2, 3, 5, 3, 1, 0, 6, 0, 1, 6, 8,
9, 3, 9, 3, 7]
vline1 = VLine()
vline1.xValues = [2,8]
vline1.color = 'CornflowerBlue'
vline2 = VLine()
vline2.xValues = [1,9]
vline2.color = 'GoldenRod'
plot = Plot()
plot.hasLegend()
plot.add(scatter)
plot.add(vline1)
plot.add(vline2)
plot.save(self.imageName)
示例7: main
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
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)
示例8: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
def constructImage(self):
line = Line()
line.xValues = [2, 1, 3, 4, 0]
line.yValues = [2, 1, 3, 4, 0]
plot = Plot()
plot.add(line)
plot.save(self.imageName)
示例9: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
def constructImage(self):
line = Line()
line.yValues = [25, 40, 30, 23, 10, 50]
line.xValues = range(len(line.yValues))
plot = Plot()
plot.add(line)
plot.xLabel = "X Label"
plot.yLabel = "Y Label"
plot.yLimits = (0, 60)
plot.save(self.imageName)
示例10: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
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)
示例11: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
def constructImage(self):
plot = Plot()
plot.projection = 'polar'
r = arange(0,1,0.001)
theta = 2*2*pi*r
line = Line()
line.xValues = theta
line.yValues = r
plot.add(line)
plot.save(self.imageName)
示例12: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
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)
示例13: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
def constructImage(self):
plot = Plot()
line = Line()
line.yValues = [25, 40, 30, 23, 10, 50]
line.xValues = range(len(line.yValues))
plot.add(line)
plot.setXLabel("X Label")
plot.setYLabel("Y Label")
plot.setYLimits(0, 60)
plot.save(self.imageName)
示例14: generatePlot
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
def generatePlot(stepType):
line = Line()
line.xValues = xVals
line.yValues = yVals
line.marker = 'o'
line.stepFunction(stepType)
plot = Plot()
plot.add(line)
plot.setTitle(r'"%s" Steps' % (stepType))
plot.setXLimits(0, 6)
plot.setYLimits(0, 6)
return plot
示例15: generatePlot
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import add [as 别名]
def generatePlot(stepType):
line = Line()
line.xValues = xVals
line.yValues = yVals
line.marker = 'o'
line.stepFunction(stepType)
plot = Plot()
plot.add(line)
plot.title = r'"%s" Steps' % (stepType)
plot.xLimits = (0, 6)
plot.yLimits = (0, 6)
return plot