當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。