本文整理汇总了Python中boomslang.Plot.setYLabel方法的典型用法代码示例。如果您正苦于以下问题:Python Plot.setYLabel方法的具体用法?Python Plot.setYLabel怎么用?Python Plot.setYLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boomslang.Plot
的用法示例。
在下文中一共展示了Plot.setYLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_plot_objects_for_group
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [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)
示例2: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [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)
示例3: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [as 别名]
def constructImage(self):
plot = Plot()
bar = Bar()
bar.xValues = range(5)
bar.yValues = [2, 8, 4, 6, 5]
plot.add(bar)
plot.setXLabel("Widget ID")
plot.setYLabel("# Widgets Sold")
plot.save(self.imageName)
示例4: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [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)
示例5: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [as 别名]
def constructImage(self):
plot = Plot()
line = Line()
line.yValues = [25, 40, 30, 23, 10, 50]
line.xValues = range(len(line.yValues))
line.xTickLabels = ["X 1", "X 2", "X 3", "X 4", "X 5"]
line.yTickLabels = ["Y Ten", "Y Twenty", "Y Thirty", "Y Forty",
"Y Fifty", "Y Sixty"]
line.yTickLabelPoints = [10, 20, 30, 40, 50, 60]
# You can set tick label properties with a dictionary ...
line.xTickLabelProperties = {
"color" : "blue",
"weight" : "bold",
"rotation" : 45
}
line.yTickLabelProperties = {
"style" : "italic",
"alpha" : 0.5,
"color" : "red"
}
# (clearing for demonstrative purposes)
line.xTickLabelProperties.clear()
line.yTickLabelProperties.clear()
# You can also set by direct elementwise access
line.xTickLabelProperties["color"] = "blue"
line.xTickLabelProperties["weight"] = "bold"
line.xTickLabelProperties["rotation"] = "45"
line.yTickLabelProperties["style"] = "italic"
line.yTickLabelProperties["alpha"] = 0.5
line.yTickLabelProperties["color"] = "red"
plot.add(line)
plot.setTitle("Craaazy Title")
plot.setTitleProperties(style="italic", weight="bold", rotation="5",
color="orange")
plot.setXLabel("X Label")
plot.setYLabel("Y Label")
plot.setYLimits(0, 60)
plot.setPlotParameters(bottom=.15, left=0.15)
plot.save(self.imageName)
示例6: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [as 别名]
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)
示例7: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [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.grid.color = "#ff0000"
plot.grid.style = "dotted"
plot.grid.visible = True
plot.save(self.imageName)
示例8: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [as 别名]
def constructImage(self):
plot = Plot()
line = Line()
line.xValues = xrange(100)
line.xTickLabels = ["Whoa this label is really long why is this label so long"]
line.xTickLabelPoints = [42]
line.xTickLabelProperties["rotation"] = 45
line.yValues = [math.sin(x) for x in xrange(100)]
line.yTickLabels = ["Look at this value. Pretty sweet value right?"]
line.yTickLabelPoints = [0.3]
plot.add(line)
plot.setXLabel("Value")
plot.setYLabel("sin(Value)")
plot.save(self.imageName)
示例9: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [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.setXTickLabelSize(24)
plot.setYTickLabelSize(36)
plot.setAxesLabelSize(18)
plot.setPlotParameters(bottom=0.14)
plot.save(self.imageName)
示例10: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [as 别名]
def constructImage(self):
line = Line()
line.xValues = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
line.yValues = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
plot = Plot()
plot.useLatexLabels()
plot.setXLabel(r"$x$")
plot.setYLabel(r"$f(x) = x^2$")
plot.setTitle(r"LaTeX is Number $\sum_{n=1}^{\infty}\frac{-e^{i\pi}}{2^n}$")
plot.add(line)
layout = PlotLayout()
layout.useLatexLabels()
layout.addPlot(plot)
layout.setAxesLabelSize(18)
layout.setPlotParameters(top=0.84)
layout.save(self.imageName)
示例11: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [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)
示例12: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [as 别名]
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.setXLabel("Shared X Axis")
plot.setYLabel("First Plot's Y Axis")
plot.setTwinX("Second Plot's Y Axis", 1)
plot.hasLegend()
plot.save(self.imageName)
示例13: constructImage
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [as 别名]
def constructImage(self):
line = Line()
line.xValues = range(5)
line.yValues = [2, 4, 6, 8, 10]
linePlot = Plot()
linePlot.add(line)
linePlot.setXLabel("X Data")
linePlot.setYLabel("Y Data")
linePlot.setTitle("Data as Line")
bar = Bar()
bar.xValues = range(5)
bar.yValues = [2, 4, 6, 8, 10]
barPlot = Plot()
barPlot.add(bar)
barPlot.setXLabel("X Data")
barPlot.setYLabel("Y Data")
barPlot.setTitle("Data as Bars")
scatter = Scatter()
scatter.xValues = range(5)
scatter.yValues = [2, 4, 6, 8, 10]
scatterPlot = Plot()
scatterPlot.add(scatter)
scatterPlot.setXLabel("X Data")
scatterPlot.setYLabel("Y Data")
scatterPlot.setTitle("Data as Points")
layout = PlotLayout()
# Plots in the same grouping are placed together on the same line
layout.addPlot(linePlot, grouping="topRow")
layout.addPlot(barPlot, grouping="topRow")
# Plots without a grouping are arranged as follows:
# * While you can make a row of N plots, where N is the size of the plot
# grouping with the largest size, do so.
# * If you can't make a row of N plots, make the plots stretch across a
# single row.
layout.addPlot(scatterPlot)
# Set values similar to those given in the "Configure subplots" sliders
# in the interactive figure
layout.setPlotParameters(hspace=0.48)
layout.save(self.imageName)
示例14: plot_timeline_for_phase
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [as 别名]
def plot_timeline_for_phase(log_directory, job, phase, phase_data):
min_timestamp = phase_data["min_timestamp"]
max_timestamp = phase_data["max_timestamp"]
description = Description(os.path.join(log_directory, job, "description"))
stage_ordering = description.getStageOrdering(phase)
duration_lists = {}
for stage in stage_ordering:
duration_lists[stage] = []
for key in phase_data:
if key in ["min_timestamp", "max_timestamp"]:
continue
hostname, stage, worker_id = key
worker_duration_info = Duration(
hostname.split('.')[0], stage, worker_id,
(phase_data[key][0] - min_timestamp) / 1000000.0,
(phase_data[key][1] - min_timestamp) / 1000000.0)
duration_lists[stage].append(worker_duration_info)
def sort_function(x):
return (x.hostname, x.worker_id, x.start_time, x.stop_time)
layout = PlotLayout()
for stage in stage_ordering:
duration_list = duration_lists[stage]
duration_list.sort(key=sort_function)
bars = {}
# Set up a "padding" bar that will appear to move bars up so that they
# start when the worker starts
start_bar = Bar()
start_bar.linewidth = 0
start_bar.color = "white"
for i, duration in enumerate(duration_list):
if duration.hostname not in bars:
bars[duration.hostname] = Bar()
bars[duration.hostname].yValues.append(
duration.stop_time - duration.start_time)
start_bar.yValues.append(duration.start_time)
# Make sure that all bars have the same number of y-axis values,
# give them x-axis values and set their colors
start_bar.xValues = range(len(start_bar.yValues))
start_bar.xTickLabelProperties = {
"rotation" : 90
}
bar_colors = ["red", "blue", "green", "orange", "gray", "pink",
"purple", "black"]
offset = 0
for i, (hostname, bar) in enumerate(bars.items()):
# Pad y axis with zeroes so that bars can be laid out next to
# each other with a StackedBars
num_y_values = len(bar.yValues)
bar.yValues = (([0] * offset) + bar.yValues +
([0] *
(len(duration_list) - (num_y_values + offset))))
# Put the label for this hostname roughly in the middle of its bar
# cluster
start_bar.xTickLabels.append(hostname)
# Subtracting 0.5 to account for half the width of the bar
start_bar.xTickLabelPoints.append(offset + (num_y_values / 2.0)
- 0.5)
offset += num_y_values
bar.xValues = range(len(bar.yValues))
bar.color = bar_colors[i % len(bar_colors)]
bar.label = hostname
stacked_bars = StackedBars()
stacked_bars.add(start_bar)
for hostname in sorted(bars.keys()):
stacked_bars.add(bars[hostname])
plot = Plot()
plot.setYLimits(0, ((max_timestamp - min_timestamp) / 1000000.0) * 1.05)
plot.setXLabel("Worker")
plot.setYLabel("Time (s)")
plot.setTitle(stage)
plot.add(stacked_bars)
layout.addPlot(plot)
#.........这里部分代码省略.........
示例15: Plot
# 需要导入模块: from boomslang import Plot [as 别名]
# 或者: from boomslang.Plot import setYLabel [as 别名]
from boomslang import Line, Plot
plot = Plot()
# Uneven error bars
line = Line()
line.xValues = range(6)
line.yValues = [25, 21, 30, 23, 10, 30]
line.yMins = [10, 18, 10, 10, 5, 20]
line.yMaxes = [30, 50, 40, 30, 20, 45]
line.label = "Asymmetric Errors"
line.color = "red"
line.xValues = range(len(line.yValues))
# Even error bars
line2 = Line()
line2.xValues = range(6)
line2.yValues = [35, 40, 45, 40, 55, 50]
line2.color = "blue"
line2.label = "Symmetric Errors"
line2.yErrors = [3, 6, 5, 3, 5, 4]
plot.add(line)
plot.add(line2)
plot.setXLabel("X Label")
plot.setYLabel("Y Label")
plot.hasLegend()
plot.save("errorbars.png")