def constructImage(self): scatter = Scatter() scatter.label = "Hooray dots with vlines!" scatter.xValues = [ 7, 6, 3, 5, 7, 6, 1, 1, 6, 5, 8, 6, 7, 8, 0, 2, 9, 3, 9, 5, 4, 5, 0, 0, 2, 3, 1, 4, 1, 3, 3, 8, 1, 5, 2, 6, 0, 3, 5, 1, 4, 9, 5, 1, 9, 9, 9, 7, 6, 5, 8, 6, 0, 2, 6, 9, 2, 5, 6, 9, 7, 8, 7, 6, 5, 9, 9, 2, 4, 9, 0, 1, 1, 1, 6, 4, 5, 8, 9, 1, 2, 1, 4, 5, 9, 7, 4, 9, 2, 9, 2, 5, 2, 2, 0, 2, 1, 9, 3, 6 ] scatter.yValues = [ 2, 5, 9, 5, 9, 3, 6, 1, 6, 0, 0, 6, 2, 5, 3, 9, 2, 7, 6, 2, 3, 1, 9, 9, 5, 2, 9, 0, 2, 3, 0, 2, 5, 5, 8, 4, 1, 9, 8, 6, 1, 6, 9, 2, 4, 9, 2, 8, 1, 1, 2, 1, 0, 6, 3, 4, 2, 5, 6, 8, 6, 9, 0, 6, 8, 6, 8, 1, 6, 2, 2, 3, 6, 2, 2, 2, 0, 2, 4, 6, 8, 5, 1, 4, 2, 3, 5, 3, 1, 0, 6, 0, 1, 6, 8, 9, 3, 9, 3, 7 ] vline1 = VLine() vline1.xValues = [2, 8] vline1.color = 'CornflowerBlue' vline2 = VLine() vline2.xValues = [1, 9] vline2.color = 'GoldenRod' plot = Plot() plot.hasLegend() plot.add(scatter) plot.add(vline1) plot.add(vline2) plot.save(self.imageName)
def __init__(self, label, color): line = Line() line.marker = "." line.label = label line.color = color self.line = line scatter = Scatter() scatter.marker = "x" scatter.color = color scatter.markerSize = 200 self.scatter = scatter
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)
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 = PlotLayout() layout.addPlot(linePlot, grouping="topRow") layout.addPlot(barPlot, grouping="topRow") layout.addPlot(scatterPlot) layout.save(self.imageName)
def constructImage(self): scatter = Scatter() scatter.label="Hooray dots!" scatter.xValues = [ 7, 6, 3, 5, 7, 6, 1, 1, 6, 5, 8, 6, 7, 8, 0, 2, 9, 3, 9, 5, 4, 5, 0, 0, 2, 3, 1, 4, 1, 3, 3, 8, 1, 5, 2, 6, 0, 3, 5, 1, 4, 9, 5, 1, 9, 9, 9, 7, 6, 5, 8, 6, 0, 2, 6, 9, 2, 5, 6, 9, 7, 8, 7, 6, 5, 9, 9, 2, 4, 9, 0, 1, 1, 1, 6, 4, 5, 8, 9, 1, 2, 1, 4, 5, 9, 7, 4, 9, 2, 9, 2, 5, 2, 2, 0, 2, 1, 9, 3, 6] scatter.yValues = [ 2, 5, 9, 5, 9, 3, 6, 1, 6, 0, 0, 6, 2, 5, 3, 9, 2, 7, 6, 2, 3, 1, 9, 9, 5, 2, 9, 0, 2, 3, 0, 2, 5, 5, 8, 4, 1, 9, 8, 6, 1, 6, 9, 2, 4, 9, 2, 8, 1, 1, 2, 1, 0, 6, 3, 4, 2, 5, 6, 8, 6, 9, 0, 6, 8, 6, 8, 1, 6, 2, 2, 3, 6, 2, 2, 2, 0, 2, 4, 6, 8, 5, 1, 4, 2, 3, 5, 3, 1, 0, 6, 0, 1, 6, 8, 9, 3, 9, 3, 7] plot = Plot() plot.hasLegend() plot.add(scatter) plot.save(self.imageName)