本文整理汇总了Python中boomslang.Line类的典型用法代码示例。如果您正苦于以下问题:Python Line类的具体用法?Python Line怎么用?Python Line使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Line类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: constructImage
def constructImage(self):
line = Line()
line.xValues = range(5)
line.yValues = [2,3,5,7,9]
line.label = "A Line"
linePlot1 = Plot()
linePlot1.title = "Small Legend"
linePlot1.add(line)
linePlot1.hasLegend()
linePlot1.legendLabelSize = 10
linePlot2 = Plot()
linePlot2.title = "Large Legend"
linePlot2.add(line)
linePlot2.hasLegend()
linePlot2.legendLabelSize = 30
linePlot3 = Plot()
linePlot3.title = "Inherited from Layout"
linePlot3.add(line)
linePlot3.hasLegend()
layout = PlotLayout()
layout.width = 2
layout.addPlot(linePlot1)
layout.addPlot(linePlot2)
layout.addPlot(linePlot3)
layout.legendLabelSize = 15
layout.save(self.imageName)
示例2: constructImage
def constructImage(self):
lines = []
for i in xrange(3):
line = Line()
line.xValues = xrange(5)
line.yValues = [(i+1 / 2.0) * pow(x, i+1) for x in line.xValues]
line.label = "Line %d" % (i + 1)
lines.append(line)
plot = Plot()
plot.add(lines[0])
inset = Plot()
inset.add(lines[1])
inset.hideTickLabels()
inset.setTitle("Inset in Yo Inset\nSo You Can Inset\nWhile You Inset")
insideInset = Plot()
insideInset.hideTickLabels()
insideInset.add(lines[2])
inset.addInset(insideInset, width=0.4, height=0.3,
location="upper left")
plot.addInset(inset, width=0.4, height=0.4, location="lower right")
plot.save(self.imageName)
示例3: constructImage
def constructImage(self):
line = Line()
line.xValues = range(5)
line.yValues = [2,3,5,7,9]
line.label = "A Line"
linePlot1 = Plot()
linePlot1.setTitle("Small Legend")
linePlot1.add(line)
linePlot1.hasLegend()
linePlot1.setLegendLabelSize(10)
linePlot2 = Plot()
linePlot2.setTitle("Large Legend")
linePlot2.add(line)
linePlot2.hasLegend()
linePlot2.setLegendLabelSize(30)
linePlot3 = Plot()
linePlot3.setTitle("Inherited from Layout")
linePlot3.add(line)
linePlot3.hasLegend()
layout = PlotLayout()
layout.setWidth(2)
layout.addPlot(linePlot1)
layout.addPlot(linePlot2)
layout.addPlot(linePlot3)
layout.setLegendLabelSize(15)
layout.setPlotParameters(left=0.03, bottom=0.03, right=0.98, top=0.94)
layout.save(self.imageName)
示例4: get_line_from_csv
def get_line_from_csv(filename, **attr_dict):
xs = []
ys = []
with open(filename) as fobj:
for line in fobj:
line = line.strip()
if line:
if ',' in line:
(x, y) = line.split(',')
elif '\t' in line:
(x, y) = line.split('\t')
else:
(x, y) = line.split()
xs += [float(x)]
ys += [float(y)]
line = Line()
line.xValues = xs
line.yValues = ys
for (attr, value) in attr_dict.items():
setattr(line, attr, value)
return line
示例5: constructImage
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)
示例6: constructImage
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)
示例7: constructImage
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)
示例8: constructImage
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)
示例9: constructImage
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)
示例10: constructImage
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)
示例11: constructImage
def constructImage(self):
line = Line()
line.xValues = range(5)
line.yValues = [2, 4, 6, 8, 10]
linePlot = Plot()
linePlot.add(line)
linePlot.xLabel = "X Data"
linePlot.yLabel = "Y Data"
linePlot.title = "Data as Line"
bar = Bar()
bar.xValues = range(5)
bar.yValues = [2, 4, 6, 8, 10]
barPlot = Plot()
barPlot.add(bar)
barPlot.xLabel = "X Data"
barPlot.yLabel = "Y Data"
barPlot.title = "Data as Bars"
scatter = Scatter()
scatter.xValues = range(5)
scatter.yValues = [2, 4, 6, 8, 10]
scatterPlot = Plot()
scatterPlot.add(scatter)
scatterPlot.xLabel = "X Data"
scatterPlot.yLabel = "Y Data"
scatterPlot.title = "Data as Points"
layout = WeightedPlotLayout()
# Plots in the same grouping are placed together on the same line
layout.addPlot(linePlot, grouping="topRow", weight=2)
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)
layout.save(self.imageName)
示例12: constructImage
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.xLabel = "X Label"
plot.yLabel = "Y Label"
plot.yLimits = (0, 60)
plot.grid.color = "#ff0000"
plot.grid.style = "dotted"
plot.grid.visible = True
plot.save(self.imageName)
示例13: constructImage
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.xLabel = "X Label"
plot.yLabel = "Y Label"
plot.yLimits = (0, 60)
plot.xTickLabelSize = 24
plot.yTickLabelSize = 36
plot.axesLabelSize = 18
plot.tight = True
plot.save(self.imageName)
示例14: constructImage
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.xLabel = r"$x$"
plot.yLabel = r"$f(x) = x^2$"
plot.title = (
r"LaTeX is Number $\sum_{n=1}^{\infty}"
r"\frac{-e^{i\pi}}{2^n}$")
plot.add(line)
plot.tight = True
plot.axesLabelSize = 18
plot.save(self.imageName)
示例15: constructImage
def constructImage(self):
plot = Plot()
for i in xrange(6):
line = Line()
line.xValues = xrange(5)
line.yValues = [(i + 1) * x for x in line.xValues]
line.label = "Line %d" % (i + 1)
plot.add(line)
plot.addLineColor("red")
plot.addLineColor("blue")
plot.addLineColor("green")
plot.addMarker("")
plot.addMarker("x")
plot.hasLegend(columns=2)
plot.save(self.imageName)