Пример #1
0
    def constructImage(self):
        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

        xVals = [1, 2, 3, 4, 5]
        yVals = [1, 2, 3, 4, 5]

        prePlot = generatePlot("pre")
        midPlot = generatePlot("mid")
        postPlot = generatePlot("post")

        layout = PlotLayout()
        layout.width = 3
        layout.addPlot(prePlot)
        layout.addPlot(midPlot)
        layout.addPlot(postPlot)
        layout.setPlotParameters(right=0.96, left=0.04)
        layout.save(self.imageName)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    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)
Пример #5
0
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("layout.png")
Пример #6
0
xVals = [1, 2, 3, 4, 5]
yVals = [1, 2, 3, 4, 5]

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

prePlot = generatePlot("pre")
midPlot = generatePlot("mid")
postPlot = generatePlot("post")

layout = PlotLayout()
layout.width = 3
layout.addPlot(prePlot)
layout.addPlot(midPlot)
layout.addPlot(postPlot)
layout.setPlotParameters(right=0.96, left=0.04)
layout.save("steps.png")
Пример #7
0
#!/usr/bin/env python

from boomslang import Line, Plot, PlotLayout

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.addPlot(plot)

layout.setAxesLabelSize(18)
layout.setPlotParameters(top=0.84)
layout.save("latex.png")