def __init__(self):
        # Create the data and the PlotData object
        x = linspace(-14, 14, 100)
        y = sin(x) * x**3
        plotdata = ArrayPlotData(x = x, y = y)
        # Create the scatter plot
        scatter = Plot(plotdata)
        scatter.plot(("x", "y"), type="scatter", color="blue")
        # Create the line plot
        line = Plot(plotdata)
        line.plot(("x", "y"), type="line", color="blue")
        # Create a horizontal container and put the two plots inside it
        container = HPlotContainer(scatter, line)
        container.spacing = 0
        scatter.padding_right = 0
        line.padding_left = 0
        line.y_axis.orientation = "right"

        self.plot = container
Exemple #2
0
    def init(self,data):
        self.raw = data
        self.data_selected = data
        index = range(self.raw.length)
        self.x1 = 0
        self.x2 = self.raw.length

        self.epsilon = self.data_selected.epsilon
        self.word_size = self.data_selected.word_size
        self.alphabet_size = self.data_selected.alphabet_size

        self.id1 = self.data_selected.id1
        self.id2 = self.data_selected.id2
        self.id3 = self.data_selected.id3

        self.window_min = self.data_selected.window_min
        self.window_max = self.data_selected.window_max
        self.window_step = self.data_selected.window_step

        self.dist_max = self.data_selected.dist_max

        overviewkwargs = {}
        for (dim,i) in zip(self.raw.data_transposed, range(len(self.plot_names))):
            overviewkwargs[self.plot_names[i]] = dim

        overviewdata = ArrayPlotData(index=index, **overviewkwargs)
        overview = Plot(overviewdata)

        axiscontainer = VPlotContainer()
        axiscontainer.spacing = 0
        aps = []
        paastep = self.selected_length / (len(self.data_selected.data_paaed[0]))
        paaindex = range(paastep/2,self.selected_length, paastep)

        for (dim,i) in zip(self.raw.data_transposed, range(len(self.plot_names))):
            overview.plot(("index",self.plot_names[i]),
                          type="line",
                          color=self.plot_colors[i])

            ap = Plot(ArrayPlotData(index = index,
                                    paaindex = paaindex,
                                    paa = self.data_selected.data_paaed[i],
                                    **{self.plot_names[i]:self.data_selected.data_transposed[i]}))

            ap.plot(("index",self.plot_names[i]), type="line", color=self.plot_colors[i])
            ap.plot(("paaindex","paa"), type="scatter", color=self.plot_colors[i])
            #ap.title = a["name"]
            ap.padding_top = 1
            ap.padding_bottom = 0
            ap.y_axis.orientation = "right"
            axiscontainer.add(ap)
            aps.append(ap)
            ap.components[1].visible = False

        self.aps = aps

        rs = RangeSelection(overview.components[0], left_button_selects= True)
        self.selector = rs
        overview.components[0].tools.append(rs)
        overview.components[0].overlays.append(RangeSelectionOverlay(component=overview.components[0]))

        lrcontainer = HPlotContainer(overview,axiscontainer)

        lrcontainer.spacing = 0
        self.plot = lrcontainer