Beispiel #1
0
class Demo(HasTraits):
    plot = Instance(Component)
    fileName = "clusters.cpickle"
    case = List(UncertaintyValue)

    cases = {}
    defaultCase = []

    # Attributes to use for the plot view.
    size = (400, 1600)

    traits_view = View(Group(
        Group(Item('plot', editor=ComponentEditor(size=size),
                   show_label=False),
              orientation="vertical",
              show_border=True,
              scrollable=True),
        Group(Item('case',
                   editor=TabularEditor(adapter=CaseAdapter(can_edit=False)),
                   show_label=False),
              orientation="vertical",
              show_border=True),
        layout='split',
        orientation='horizontal'),
                       title='Interactive Lines',
                       resizable=True)

    def setFileName(self, newName):
        self.fileName = newName

    def _update_case(self, name):

        if name:
            self.case = self.cases.get(name)

        else:
            self.case = self.defaultCase

    def _plot_default(self):

        #load the data to visualize.
        # it is a list of data in the 'results' format, each belonging to a cluster - gonenc
        resultsList = cPickle.load(open(self.fileName, 'r'))

        #get the names of the outcomes to display
        outcome = []
        for entry in resultsList:
            a = entry[0][1].keys()
            outcome.append(a[0])

#        outcome = resultsList[0][0][1].keys()

# pop the time axis from the list of outcomes
#        outcome.pop(outcome.index('TIME'))
        x = resultsList[0][0][1]['TIME']

        # the list and number of features (clustering related) stored regarding each run
        features = resultsList[0][0][0][0].keys()
        noFeatures = len(features)

        # Iterate over each cluster to prepare the cases corresponding to indivisdual runs in
        # each cluster plot. Each case is labeled as, e.g., y1-2 (3rd run in the 2nd cluster) - gonenc
        for c, results in enumerate(resultsList):
            for j, aCase in enumerate(results):
                aCase = [
                    UncertaintyValue(name=key, value=value)
                    for key, value in aCase[0][0].items()
                ]
                self.cases['y' + str(c) + '-' + str(j)] = aCase


#        for j, aCase in enumerate(results):
#            aCase = [UncertaintyValue(name="blaat", value=aCase[0][0])]
#            self.cases['y'+str(j)] = aCase

#make an empty case for default.
#if you have multiple datafields associated with a run, iterate over
#the keys of a dictionary of a case, instead of over lenght(2)
        case = []
        for i in range(noFeatures):
            case.append(UncertaintyValue(name='Default', value='None'))
        self.case = case
        self.defaultCase = case

        # Create some x-y data series to plot
        pds = []
        # enumerate over the results of all clusters
        for c, results in enumerate(resultsList):
            pd = ArrayPlotData(index=x)
            for j in range(len(results)):
                data = np.array(results[j][1].get(outcome[c]))
                print "y" + str(c) + '-' + str(j)
                pd.set_data("y" + str(c) + '-' + str(j), data)
            pds.append(pd)

        # Create a container and add our plots
        container = GridContainer(bgcolor="lightgray",
                                  use_backbuffer=True,
                                  shape=(len(resultsList), 1))

        #plot data
        tools = []
        for c, results in enumerate(resultsList):
            pd1 = pds[c]

            # Create some line plots of some of the data
            plot = Plot(pd1,
                        title='Cluster ' + str(c),
                        border_visible=True,
                        border_width=1)
            plot.legend.visible = False

            #plot the results
            for i in range(len(results)):
                plotvalue = "y" + str(c) + '-' + str(i)
                print plotvalue
                color = colors[i % len(colors)]
                plot.plot(("index", plotvalue), name=plotvalue, color=color)

            #make sure that the time axis runs in the right direction
            for value in plot.plots.values():
                for entry in value:
                    entry.index.sort_order = 'ascending'

            # Attach the selector tools to the plot
            selectorTool1 = LineSelectorTool(component=plot)
            plot.tools.append(selectorTool1)
            tools.append(selectorTool1)

            # Attach some tools to the plot
            plot.tools.append(PanTool(plot))
            zoom = ZoomTool(component=plot, tool_mode="box", always_on=False)
            plot.overlays.append(zoom)

            container.add(plot)

        #make sure the selector tools knows the main screen
        for tool in tools:
            tool._demo = self

        return container
Beispiel #2
0
    def __init__(self):
        super(CyclesPlot, self).__init__()

        # Normally you'd pass in the data, but I'll hardwire things for this
        #    one-off plot.

        srecs = read_time_series_from_csv("./biz_cycles2.csv",
                                          date_col=0,
                                          date_format="%Y-%m-%d")

        dt = srecs["Date"]

        # Industrial production compared with trend (plotted on value axis)
        iprod_vs_trend = srecs["Metric 1"]

        # Industrial production change in last 6 Months (plotted on index axis)
        iprod_delta = srecs["Metric 2"]

        self._dates = dt
        self._series1 = self._selected_s1 = iprod_delta
        self._series2 = self._selected_s2 = iprod_vs_trend

        end_x = np.array([self._selected_s1[-1]])
        end_y = np.array([self._selected_s2[-1]])

        plotdata = ArrayPlotData(x=self._series1,
                                 y=self._series2,
                                 dates=self._dates,
                                 selected_x=self._selected_s1,
                                 selected_y=self._selected_s2,
                                 endpoint_x=end_x,
                                 endpoint_y=end_y)

        cycles = Plot(plotdata, padding=20)

        cycles.plot(("x", "y"), type="line", color=(.2, .4, .5, .4))

        cycles.plot(("selected_x", "selected_y"),
                    type="line",
                    marker="circle",
                    line_width=3,
                    color=(.2, .4, .5, .9))

        cycles.plot(("endpoint_x", "endpoint_y"),
                    type="scatter",
                    marker_size=4,
                    marker="circle",
                    color=(.2, .4, .5, .2),
                    outline_color=(.2, .4, .5, .6))

        cycles.index_range = DataRange1D(low_setting=80., high_setting=120.)

        cycles.value_range = DataRange1D(low_setting=80., high_setting=120.)

        # dig down to use actual Plot object
        cyc_plot = cycles.components[0]

        # Add the labels in the quadrants
        cyc_plot.overlays.append(
            PlotLabel("\nSlowdown" + 40 * " " + "Expansion",
                      component=cyc_plot,
                      font="swiss 24",
                      color=(.2, .4, .5, .6),
                      overlay_position="inside top"))

        cyc_plot.overlays.append(
            PlotLabel("Downturn" + 40 * " " + "Recovery\n ",
                      component=cyc_plot,
                      font="swiss 24",
                      color=(.2, .4, .5, .6),
                      overlay_position="inside bottom"))

        timeline = Plot(plotdata, resizable='h', height=50, padding=20)
        timeline.plot(("dates", "x"),
                      type="line",
                      color=(.2, .4, .5, .8),
                      name='x')
        timeline.plot(("dates", "y"),
                      type="line",
                      color=(.5, .4, .2, .8),
                      name='y')

        # Snap on the tools
        zoomer = ZoomTool(timeline,
                          drag_button="right",
                          always_on=True,
                          tool_mode="range",
                          axis="index",
                          max_zoom_out_factor=1.1)

        panner = PanTool(timeline, constrain=True, constrain_direction="x")

        # dig down to get Plot component I want
        x_plt = timeline.plots['x'][0]

        range_selection = RangeSelection(x_plt, left_button_selects=True)
        range_selection.on_trait_change(self.update_interval, 'selection')

        x_plt.tools.append(range_selection)
        x_plt.overlays.append(RangeSelectionOverlay(x_plt))

        # Set the plot's bottom axis to use the Scales ticking system
        scale_sys = CalendarScaleSystem(
            fill_ratio=0.4,
            default_numlabels=5,
            default_numticks=10,
        )
        tick_gen = ScalesTickGenerator(scale=scale_sys)

        bottom_axis = ScalesPlotAxis(timeline,
                                     orientation="bottom",
                                     tick_generator=tick_gen)

        # Hack to remove default axis - FIXME: how do I *replace* an axis?
        del (timeline.underlays[-2])

        timeline.overlays.append(bottom_axis)

        container = GridContainer(padding=20,
                                  fill_padding=True,
                                  bgcolor="lightgray",
                                  use_backbuffer=True,
                                  shape=(2, 1),
                                  spacing=(30, 30))

        # add a central "x" and "y" axis

        x_line = LineInspector(cyc_plot,
                               is_listener=True,
                               color="gray",
                               width=2)
        y_line = LineInspector(cyc_plot,
                               is_listener=True,
                               color="gray",
                               width=2,
                               axis="value")

        cyc_plot.overlays.append(x_line)
        cyc_plot.overlays.append(y_line)

        cyc_plot.index.metadata["selections"] = 100.0
        cyc_plot.value.metadata["selections"] = 100.0

        container.add(cycles)
        container.add(timeline)

        container.title = "Business Cycles"

        self.plot = container
class Demo(HasTraits):
    plot = Instance(Component)
    fileName = "default.txt"
    case = List(UncertaintyValue)
    cases = {}

    defaultCase = []

    # Attributes to use for the plot view.
    size = (400, 250)

    traits_view = View(Group(
        Group(Item('plot', editor=ComponentEditor(size=size),
                   show_label=False),
              orientation="vertical",
              show_border=True),
        Group(Item('case',
                   editor=TabularEditor(adapter=CaseAdapter(can_edit=False)),
                   show_label=False),
              orientation="vertical",
              show_border=True),
        layout='split',
        orientation='horizontal'),
                       title='Interactive Lines',
                       resizable=True)

    def setFileName(self, newName):
        self.fileName = newName

    def _update_case(self, name):

        if name:
            self.case = self.cases.get(name)

        else:
            self.case = self.defaultCase

    def _plot_default(self):
        results = cPickle.load(open(self.fileName, 'r'))
        outcomes = results[0][1].keys()
        outcomes.pop(outcomes.index('TIME'))
        x = results[0][1]['TIME']

        for j, aCase in enumerate(results):
            aCase = [
                UncertaintyValue(name=key, value=value)
                for key, value in aCase[0][0].items()
            ]
            self.cases['y' + str(j)] = aCase

        uncertainties = results[0][0][0]
        uncertaintynames = uncertainties.keys()
        uncertaintyvalues = []
        for key in uncertainties.keys():
            uncertaintyvalues.append(uncertainties[key])

        case = []
        for i in range(len(uncertainties)):
            case.append(
                UncertaintyValue(name=str(uncertaintynames[i]),
                                 value=""))  #haydaa
        self.case = case
        self.defaultCase = case

        # Create some x-y data series to plot
        pds = []
        for i, outcome in enumerate(outcomes):
            pd = ArrayPlotData(index=x)
            for j in range(len(results)):
                pd.set_data("y" + str(j), results[j][1].get(outcome))
            pds.append(pd)

        # Create a container and add our plots
        container = GridContainer(bgcolor="lightgray",
                                  use_backbuffer=True,
                                  shape=(1, 1))

        #plot data
        tools = []
        for j in range(len(outcomes)):
            pd1 = pds[j]

            # Create some line plots of some of the data
            plot = Plot(pd1,
                        title=outcomes[j],
                        border_visible=True,
                        border_width=1)
            plot.legend.visible = False

            for i in range(len(results)):
                plotvalue = "y" + str(i)
                color = colors[i % len(colors)]
                plot.plot(("index", plotvalue), name=plotvalue, color=color)

            for value in plot.plots.values():
                for entry in value:
                    entry.index.sort_order = 'ascending'

            # Attach the selector tools to the plot
            selectorTool1 = LineSelectorTool(component=plot)
            plot.tools.append(selectorTool1)
            tools.append(selectorTool1)

            # Attach some tools to the plot
            plot.tools.append(PanTool(plot))
            zoom = ZoomTool(component=plot, tool_mode="box", always_on=False)
            plot.overlays.append(zoom)

            container.add(plot)

        #make sure the selector tools know each other

        for tool in tools:
            tool._demo = self

        return container
Beispiel #4
0
    def get_plot(self):
        #pd = ArrayPlotData()
        index_label = 'index'
        index = None
        colors = ['purple','blue','green','gold', 'orange', 'red', 'black']
        groups = defaultdict(lambda:[])

        pd = ArrayPlotData()

        index_values = None
        if 'relative time' in self.table:
            index_key = 'relative time'
            index_values = self.table[index_key]
        else:
            index_key = 'index'
        index_label = index_key

        for key, values in self.table.items():
            if index_values is None:
                index_values = range(len(values))
            if key==index_label:
                continue
            if key.startswith('stage '):
                label = key[6:].strip()
                group = groups['stages']
            elif key=='contact position':
                label = key
                group = groups['stages']
            elif key.startswith('fiber '):

                if key.endswith('deformation'):
                    label = key[5:-11].strip()
                    group = groups['fiber deformation']
                elif key.endswith('position'):
                    label = key[5:-8].strip()
                    group = groups['fiber position']
                else:
                    label = key[5:].strip ()
                    group = groups['fiber']
            elif key.startswith('sarcomere '):
                label = key[10:].strip()
                if label=='orientation': # this is artificial information
                    continue
                group = groups['sarcomere']
            else:
                label = key
                group = groups[key]

            group.append((index_label, label, index_key, key))
            pd.set_data(key, values)

        pd.set_data (index_key, index_values)

        if 'force' in self.table and 'stage right current' in self.table:
            group = groups['position-force']
            group.append(('position','force','stage right current','force'))



        n = len (groups)
        if n in [0,1,2,3,5,7]:
            shape = (n, 1)
        elif n in [4,6,8,10]:
            shape = (n//2,2)
        elif n in [9]:
            shape = (n//3,3)
        else:
            raise NotImplementedError (`n`)

        container = GridContainer(padding=10, #fill_padding=True,
                                  #bgcolor="lightgray", use_backbuffer=True,
                                  shape=shape, spacing=(0,0))

        for i, (group_label, group_info) in enumerate(groups.items ()):
            plot = Plot (pd)
            for j, (index_label, label, index_key, key) in enumerate(group_info):
                color = colors[j % len (colors)]
                plot.plot((index_key, key), name=label, color=color, x_label=index_label)
            plot.legend.visible = True
            plot.title = group_label
            plot.tools.append(PanTool(plot))
            zoom = ZoomTool(component=plot, tool_mode="box", always_on=False)
            plot.overlays.append(zoom)
            container.add (plot)

        return container
Beispiel #5
0
    def get_plot(self):
        pixel_sizes = self.data_source.voxel_sizes
        shape = self.data.shape
        m = min(pixel_sizes)
        s = [int(d * sz / m) for d, sz in zip(shape, pixel_sizes)]
        if 1:  # else physical aspect ratio is enabled
            ss = max(s) / 4
            s = [max(s, ss) for s in s]
        plot_sizes = dict(xy=(s[2], s[1]),
                          xz=(s[2], s[0]),
                          zy=(s[0], s[1]),
                          zz=(s[0], s[0]))

        plots = GridContainer(shape=(2, 2),
                              spacing=(3, 3),
                              padding=50,
                              aspect_ratio=1)
        pxy = Plot(
            self.plotdata,
            padding=1,
            fixed_preferred_size=plot_sizes['xy'],
            x_axis=PlotAxis(orientation='top'),
        )
        pxz = Plot(
            self.plotdata,
            padding=1,
            fixed_preferred_size=plot_sizes['xz'],
        )
        pzy = Plot(
            self.plotdata,
            padding=1,
            fixed_preferred_size=plot_sizes['zy'],
            #orientation = 'v',  # cannot use 'v' because of img_plot assumes row-major ordering
            x_axis=PlotAxis(orientation='top'),
            y_axis=PlotAxis(orientation='right'),
        )
        pzz = Plot(self.plotdata,
                   padding=1,
                   fixed_preferred_size=plot_sizes['zz'])

        plots.add(pxy, pzy, pxz, pzz)

        self.plots = dict(
            xy=pxy.img_plot('xy', colormap=bone)[0],
            xz=pxz.img_plot('xz', colormap=bone)[0],
            zy=pzy.img_plot('zy', colormap=bone)[0],
            zz=pzz.img_plot('zz')[0],
            xyp=pxy.plot(('z_x', 'z_y'),
                         type='scatter',
                         color='orange',
                         marker='circle',
                         marker_size=3,
                         selection_marker_size=3,
                         selection_marker='circle')[0],
            xzp=pxz.plot(('y_x', 'y_z'),
                         type='scatter',
                         color='orange',
                         marker='circle',
                         marker_size=3,
                         selection_marker_size=3,
                         selection_marker='circle')[0],
            zyp=pzy.plot(('x_z', 'x_y'),
                         type='scatter',
                         color='orange',
                         marker='circle',
                         marker_size=3,
                         selection_marker_size=3,
                         selection_marker='circle')[0],
        )

        for p in ['xy', 'xz', 'zy']:
            self.plots[p].overlays.append(ZoomTool(self.plots[p]))
            self.plots[p].tools.append(
                PanTool(self.plots[p], drag_button='right'))

            imgtool = ImageInspectorTool(self.plots[p])
            self.plots[p].tools.append(imgtool)
            overlay = ImageInspectorOverlay(component=self.plots[p],
                                            bgcolor='white',
                                            image_inspector=imgtool)
            self.plots['zz'].overlays.append(overlay)

            self.plots[p + 'p'].tools.append(
                ScatterInspector(self.plots[p + 'p'], selection_mode='toggle'))

        self.plots['xyp'].index.on_trait_change(self._xyp_metadata_handler,
                                                'metadata_changed')
        self.plots['xzp'].index.on_trait_change(self._xzp_metadata_handler,
                                                'metadata_changed')
        self.plots['zyp'].index.on_trait_change(self._zyp_metadata_handler,
                                                'metadata_changed')

        plot = HPlotContainer()
        # todo: add colormaps
        plot.add(plots)
        return plot
Beispiel #6
0
    def _create_plot_window(self):
        # Create the model
        min_value = 350
        max_value = self.max_data
        image_value_range = DataRange1D(low=min_value, high=max_value)
        self.cmap = jet(range=image_value_range)
        self._update_model()
        datacube = self.colorcube

        # Create the plot
        self.plotdata = ArrayPlotData()
        self.plotdataVoxel = ArrayPlotData()
        self.plotdataSlices = ArrayPlotData()
        self.plotdataVoxelFFT = ArrayPlotData()
        self.plotdataPC = ArrayPlotData()
        self._update_images()

        # Top Left plot
        centerplot = Plot(self.plotdata,
                          resizable='hv',
                          padding=20,
                          title="Slice_X")
        imgplot = centerplot.img_plot("yz",
                                      xbounds=None,
                                      ybounds=None,
                                      colormap=self.cmap)[0]

        centerplot.x_axis.title = "Y"
        centerplot.y_axis.title = "Z"
        self._add_plot_tools(imgplot, "yz")
        self.cursorYZ = CursorTool(imgplot, drag_button='left', color='white')
        self.cursorYZ.current_position = self.slice_y, self.slice_z
        imgplot.overlays.append(self.cursorYZ)
        self.center = imgplot

        # Top Right Plot
        rightplot = Plot(self.plotdata,
                         resizable='hv',
                         padding=20,
                         title="Slice_Y")
        rightplot.x_axis.title = "X"
        rightplot.y_axis.title = "Z"
        imgplot = rightplot.img_plot("xz",
                                     xbounds=None,
                                     ybounds=None,
                                     colormap=self.cmap)[0]

        self._add_plot_tools(imgplot, "xz")
        self.cursorXZ = CursorTool(imgplot, drag_button='left', color='white')
        self.cursorXZ.current_position = self.slice_x, self.slice_z
        imgplot.overlays.append(self.cursorXZ)
        self.right = imgplot

        # Bottom  LeftPlot
        bottomplot = Plot(self.plotdata,
                          resizable='hv',
                          padding=20,
                          title="Slice_Z")
        bottomplot.x_axis.title = "Y"
        bottomplot.y_axis.title = "X"
        imgplot = bottomplot.img_plot("xy",
                                      xbounds=None,
                                      ybounds=None,
                                      colormap=self.cmap)[0]
        """bottomplot.contour_plot("xy", 
                          type="poly",
                          xbounds=None,
                          ybounds=None)[0]"""

        self._add_plot_tools(imgplot, "xy")
        self.cursorXY = CursorTool(imgplot, drag_button='left', color='white')
        self.cursorXY.current_position = self.slice_y, self.slice_x
        imgplot.overlays.append(self.cursorXY)
        self.bottom = imgplot
        """ # Create a colorbar
        cbar_index_mapper = LinearMapper(range=image_value_range)
        self.colorbar = ColorBar(index_mapper=cbar_index_mapper,
                                 plot=centerplot,
                                 padding_top=centerplot.padding_top,
                                 padding_bottom=centerplot.padding_bottom,
                                 padding_right=40,
                                 resizable='v',
                                 width=30, height = 100)"""

        # Create data series to plot
        timeplot = Plot(self.plotdataVoxel, resizable='hv', padding=20)
        timeplot.x_axis.title = "Frames"
        timeplot.plot("TimeVoxel",
                      color='lightblue',
                      line_width=1.0,
                      bgcolor="white",
                      name="Time")[0]
        # for i in range(len(self.tasks)):
        #         timeplot.plot(self.timingNames[i+2],color=tuple(COLOR_PALETTE[i]),
        #         line_width=1.0, bgcolor = "white", border_visible=True, name = self.timingNames[i+2])[0]

        timeplot.legend.visible = True
        timeplot.plot("time",
                      type="scatter",
                      color=tuple(COLOR_PALETTE[2]),
                      line_width=1,
                      bgcolor="white",
                      border_visible=True,
                      name="time")[0]
        self.timePlot = timeplot
        # Create data series to plot
        timeplotBig = Plot(self.plotdataVoxel, resizable='hv', padding=20)
        timeplotBig.x_axis.title = "Frames"
        timeplotBig.plot("TimeVoxel",
                         color='lightblue',
                         line_width=1.5,
                         bgcolor="white",
                         name="Time")[0]
        timeplotBig.legend.visible = True
        timeplotBig.plot("time",
                         type="scatter",
                         color=tuple(COLOR_PALETTE[2]),
                         line_width=1,
                         bgcolor="white",
                         border_visible=True,
                         name="time")[0]
        self.timePlotBig = timeplotBig

        # Create data series to plot
        freqplotBig = Plot(self.plotdataVoxelFFT, resizable='hv', padding=20)
        freqplotBig.x_axis.title = "Frequency (Hz)"
        freqplotBig.plot("FreqVoxel",
                         color='lightblue',
                         line_width=1.5,
                         bgcolor="white",
                         name="Abs(Y)")[0]
        freqplotBig.legend.visible = True
        freqplotBig.plot("peaks",
                         type="scatter",
                         color=tuple(COLOR_PALETTE[2]),
                         line_width=1,
                         bgcolor="white",
                         border_visible=True,
                         name="peaks")[0]
        self.freqPlotBig = freqplotBig

        # Create data series to plot
        PCplotBig = Plot(self.plotdataPC, resizable='hv', padding=20)
        PCplotBig.x_axis.title = "Frames"
        PCplotBig.plot("Principal Component",
                       color='lightblue',
                       line_width=1.5,
                       bgcolor="white",
                       name="Principal Component")[0]
        PCplotBig.legend.visible = True
        PCplotBig.plot("time",
                       type="scatter",
                       color=tuple(COLOR_PALETTE[2]),
                       line_width=1,
                       bgcolor="white",
                       border_visible=True,
                       name="time")[0]
        self.PCplotBig = PCplotBig

        #self.time = time
        # Create a GridContainer to hold all of our plots
        container = GridContainer(padding=10,
                                  fill_padding=True,
                                  bgcolor="white",
                                  use_backbuffer=True,
                                  shape=(2, 2),
                                  spacing=(10, 10))
        containerTime = GridContainer(padding=10,
                                      fill_padding=True,
                                      bgcolor="white",
                                      use_backbuffer=True,
                                      shape=(1, 1),
                                      spacing=(5, 5))

        containerFreq = GridContainer(padding=10,
                                      fill_padding=True,
                                      bgcolor="white",
                                      use_backbuffer=True,
                                      shape=(1, 1),
                                      spacing=(5, 5))
        containerPC = GridContainer(padding=10,
                                    fill_padding=True,
                                    bgcolor="white",
                                    use_backbuffer=True,
                                    shape=(1, 1),
                                    spacing=(5, 5))

        container.add(centerplot)
        container.add(rightplot)
        container.add(bottomplot)
        container.add(timeplot)
        containerTime.add(timeplotBig)
        containerFreq.add(freqplotBig)
        containerPC.add(PCplotBig)
        """container = GridContainer(padding=10, fill_padding=True,
                              bgcolor="white", use_backbuffer=True,
                              shape=(3,3), spacing=(10,10))
       
        for i in range(14,23):
             slicePlot = Plot(self.plotdataSlices, resizable= 'hv', padding=20,title = "slice " + str(i),bgcolor = "white")
             slicePlot.img_plot("slice " + str(i),xbounds= None, ybounds= None, colormap=self.cmap,bgcolor = "white")[0]
             container.add(slicePlot)"""

        self.container = container
        self.nb.DeleteAllPages()
        self.window = Window(self.nb, -1, component=container)
        self.windowTime = Window(self.nb, -1, component=containerTime)
        self.windowFreq = Window(self.nb, -1, component=containerFreq)
        self.windowPC = Window(self.nb, -1, component=containerPC)
        self.sizer.Detach(self.topsizer)
        self.sizer.Detach(self.pnl2)
        self.topsizer.Clear()
        self.topsizer.Add(self.pnl3, 0, wx.ALL, 10)
        self.nb.AddPage(self.window.control, "fMRI Slices")
        self.nb.AddPage(self.windowTime.control, "Time Voxel")
        self.nb.AddPage(self.windowFreq.control, "Frequency Voxel")
        self.nb.AddPage(self.windowPC.control, "Principal Component")
        self.topsizer.Add(self.nb, 1, wx.EXPAND)
        self.sizer.Add(self.topsizer, 1, wx.EXPAND)
        self.sizer.Add(self.pnl2,
                       flag=wx.EXPAND | wx.BOTTOM | wx.TOP,
                       border=10)

        self.SetSizer(self.sizer)
        self.Centre()
        self.Show(True)