当前位置: 首页>>代码示例>>Python>>正文


Python Plot.setXLimits方法代码示例

本文整理汇总了Python中boomslang.Plot.setXLimits方法的典型用法代码示例。如果您正苦于以下问题:Python Plot.setXLimits方法的具体用法?Python Plot.setXLimits怎么用?Python Plot.setXLimits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boomslang.Plot的用法示例。


在下文中一共展示了Plot.setXLimits方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_plot_objects_for_group

# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setXLimits [as 别名]
def create_plot_objects_for_group(phase_name, group_name, min_timestamp,
                                  max_timestamp, make_legend):
    """
    Create and format two Boomslang plot objects: one for the time series plot,
    and the other for a CDF of the y-axis values in the time series. min and
    max timestamps are assumed to be adjusted with timestamp_adjuster (see
    below) before being passed as arguments
    """

    time_series_plot = Plot()
    time_series_plot.setXLimits(
        0, (max_timestamp - min_timestamp) / 1000000.0)
    time_series_plot.setXLabel("Time (s)")
    time_series_plot.setYLabel(group_name)
    cdf_plot = Plot()
    cdf_plot.setXLabel(group_name)
    cdf_plot.setYLabel("CDF")

    for plot in [time_series_plot, cdf_plot]:
        if make_legend:
            plot.hasLegend(labelSize = 8, columns=2)

        plot.setTitle("Phase: %(phase_name)s, %(group_name)s" %
                      {"phase_name" : phase_name, "group_name" : group_name})

        for color in ["red", "green", "blue", "teal", "orange", "purple",
                      "brown", "black"]:
            plot.addLineColor(color)

        for style in ["solid", "dashed", "dotted"]:
            plot.addLineStyle(style)

    return (time_series_plot, cdf_plot)
开发者ID:TritonNetworking,项目名称:themis_tritonsort,代码行数:35,代码来源:time_series_plot.py

示例2: histogram_plot

# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setXLimits [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)
开发者ID:TritonNetworking,项目名称:themis_tritonsort,代码行数:62,代码来源:histogram_plot.py

示例3: constructImage

# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setXLimits [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.setXLabel("X Label")
        plot.setYLabel("Y Label")
        plot.hasLegend()
        plot.setXLimits(-1, 13)
        plot.save(self.imageName)
开发者ID:jcmdev0,项目名称:boomslang,代码行数:29,代码来源:test_errorbars.py

示例4: generatePlot

# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setXLimits [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
开发者ID:jcmdev0,项目名称:boomslang,代码行数:16,代码来源:test_steps.py

示例5: constructImage

# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setXLimits [as 别名]
    def constructImage(self):
        line = Line()
        line.xValues = numpy.arange(0, 150, 0.01)
        line.yValues = numpy.cos(.02 * numpy.pi * line.xValues)

        plot = Plot()
        plot.add(line)
        plot.setXLimits(0, 150)
        plot.setYLimits(-1, 1)
        plot.setXLabel("X")
        plot.setYLabel("cos(X)")
        splitPlots = plot.split(2)

        layout = PlotLayout()
        layout.width = 2
        layout.addPlot(plot, grouping="unsplit")

        for s in splitPlots:
            layout.addPlot(s, grouping="splits")

        layout.save(self.imageName)
开发者ID:jcmdev0,项目名称:boomslang,代码行数:23,代码来源:test_split.py

示例6: constructImage

# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setXLimits [as 别名]
    def constructImage(self):
        line1 = Line()
        line2 = Line()
        line3 = Line()

        line1.xValues = range(0,10)
        line1.yValues = [2,5,2,3,2,2,1,0,1,0]
        line2.xValues = range(0,10)
        line2.yValues = [3,1,2,3,2,1,5,3,1,7]
        line3.xValues = range(0,10)
        line3.yValues = [2,1,3,1,3,4,1,4,5,0]

        stack = StackedLines()
        stack.addLine(line1, "red")
        stack.addLine(line2, "green")
        stack.addLine(line3, "blue")

        plot = Plot()
        plot.setYLimits(0, 7)
        plot.setXLimits(0, 9)
        plot.add(stack)
        plot.save(self.imageName)
开发者ID:jcmdev0,项目名称:boomslang,代码行数:24,代码来源:test_stackedlines.py

示例7: Line

# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setXLimits [as 别名]
#!/usr/bin/env python

from boomslang import Plot, Line, PlotLayout
import numpy

line = Line()
line.xValues = numpy.arange(0, 150, 0.01)
line.yValues = numpy.cos(.02 * numpy.pi * line.xValues)

plot = Plot()
plot.add(line)
plot.setXLimits(0, 150)
plot.setYLimits(-1, 1)
plot.setXLabel("X")
plot.setYLabel("cos(X)")
splitPlots = plot.split(2)

layout = PlotLayout()
layout.width = 2
layout.addPlot(plot, grouping="unsplit")

for s in splitPlots:
    layout.addPlot(s, grouping="splits")

layout.save("split.png")
开发者ID:crazyideas21,项目名称:dev,代码行数:27,代码来源:split.py


注:本文中的boomslang.Plot.setXLimits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。