當前位置: 首頁>>代碼示例>>Python>>正文


Python api.VPlotContainer類代碼示例

本文整理匯總了Python中chaco.api.VPlotContainer的典型用法代碼示例。如果您正苦於以下問題:Python VPlotContainer類的具體用法?Python VPlotContainer怎麽用?Python VPlotContainer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了VPlotContainer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _create_plot_component

def _create_plot_component(obj):
    # Spectrogram plot

    obj.data = fr.getDataSets(".chi")
    frequencies = obj.data[0][0]
    index = ArrayDataSource(data=frequencies)

    values = [obj.data[i][1] for i in xrange(len(obj.data))]
    print len(obj.data[1][1])
    print len(obj.data)
    p = WaterfallRenderer(
        index=index,
        values=values,
        index_mapper=LinearMapper(range=DataRange1D(low=0, high=SPECTROGRAM_LENGTH)),
        value_mapper=LinearMapper(range=DataRange1D(low=0, high=SPECTROGRAM_LENGTH)),
        x2_mapper=LinearMapper(low_pos=0, high_pos=100, range=DataRange1D(low=10.0, high=101.0)),
        y2_mapper=LinearMapper(low_pos=0, high_pos=100, range=DataRange1D(low=0, high=600000)),
    )
    spectrogram_plot = p
    obj.spectrogram_plot = p
    dummy = Plot()
    dummy.padding = 50
    dummy.index_axis.mapper.range = p.index_mapper.range
    dummy.index_axis.title = "Frequency (hz)"
    dummy.add(p)

    c2 = VPlotContainer()
    c2.add(dummy)

    return c2
開發者ID:pavoljuhas,項目名稱:pyxda,代碼行數:30,代碼來源:waterfallrenderer.py

示例2: _plot_default

    def _plot_default(self):
        plotter = Plot(data=self.data)
        main_plot = plotter.plot(['x','y'])[0]
        self.configure_plot(main_plot, xlabel='')

        plotter2 = Plot(data=self.data)
        zoom_plot = plotter2.plot(['x','y'])[0]
        self.configure_plot(zoom_plot)

        plotter3 = Plot(data = self.data)
        events_plot = plotter3.plot(['x','y'])[0]
        self.configure_plot(events_plot)
        
        outer_container = VPlotContainer(padding=20,
                                         fill_padding=True,
                                         spacing=0,
                                         stack_order='top_to_bottom',
                                         bgcolor='lightgray',
                                         use_backbuffer=True)

        outer_container.add(main_plot)
        outer_container.add(zoom_plot)
        outer_container.add(events_plot)
        # FIXME: This is set to the windows bg color.  Should get from the system.
        #outer_container.bgcolor = (236/255., 233/255., 216/255., 1.0)

        main_plot.controller = RangeSelection(main_plot)
        
        zoom_overlay = ZoomOverlay(source=main_plot, destination=zoom_plot)
        outer_container.overlays.append(zoom_overlay)

        return outer_container
開發者ID:ANDDYYYY,項目名稱:dmitri-plot,代碼行數:32,代碼來源:eg1.py

示例3: create_vplot

    def create_vplot(self):
        ''' fill vplot container with 1 mini plot for range selection
        and N main plots ordered from to top to bottom by freq
        '''
        vpc = VPlotContainer(bgcolor='lightgrey')
        if self.model.freq_choices:
            # create mini plot using the highest freq as background
            keys = self.model.freq_choices
            mini = self.create_hplot(key=keys[-1], mini=True)
            self.mini_hplot = mini
            vpc.add(mini)

            # create hplot containers for each freq and add to dict.
            # dictionary will be used to access these later to individually
            # address them to turn them on or off etc.
            # note these are added with lowest freq on bottom
            for freq in self.model.freq_choices:
                hpc = self.create_hplot(key=freq)
                self.hplot_dict[freq] = hpc
                vpc.add(hpc)

        # add tool to freeze line inspector cursor when in desired position
        vpc.tools.append(self.inspector_freeze_tool)

        self.vplot_container = vpc
        self.set_hplot_visibility(all=True)
        self.set_intensity_profile_visibility()
開發者ID:atxreyes,項目名稱:hydropick,代碼行數:27,代碼來源:survey_views.py

示例4: __init__

    def __init__(self):

        super(HHCurrentTraits, self).__init__()

        # gates
        self.vm = linspace(-120,65,1000)
        (M, N, H) = self.__gates()
        nA = self.__iv()
        self.gatedata = ArrayPlotData(x=self.vm, M=M, N=N, H=H)
        self.ivdata = ArrayPlotData(x=self.vm, nA=nA)
        
        gateplot = Plot(self.gatedata)
        gateplot.plot(("x", "M"), type = "line", color = "blue")
        gateplot.plot(("x", "N"), type = "line", color = "green")
        gateplot.plot(("x", "H"), type = "line", color = "red")

        ivplot = Plot(self.ivdata)
        ivplot.plot(("x", "nA"), type = "line", color = "black")

        container = VPlotContainer(ivplot, gateplot)
        container.spacing = 0
        gateplot.x_axis.orientation = "top"
        gateplot.padding_bottom = 0
        ivplot.padding_top = 0
        
        self.plots = container
開發者ID:matthewperkins,項目名稱:plotting,代碼行數:26,代碼來源:DynClmpSSHandFiter.py

示例5: WaveformDisplay

class WaveformDisplay(TwoDimensionalPlot):
	marker_height = 50

	def __init__(self, parent, *args, **kwargs):
		TwoDimensionalPlot.__init__(self, parent, *args, **kwargs)

		self.padding_left = 50

		self.title = 'Waveform'

		self.vplot_container = VPlotContainer(use_backbuffer=True)
		self.vplot_container.stack_order = 'top_to_bottom'
		self.vplot_container.add(self)

	@property
	def control(self):
		return Window(self.parent, component=self.vplot_container).control

	def add_marker(self, num, data):
		marker_plot = TwoDimensionalPlot(self, height=self.marker_height, resizable='h')
		marker_plot.padding_left = self.padding_left

		marker_plot.x_data = self.x_data
		marker_plot.y_data = data
		marker_plot.title = 'Marker {0}'.format(num)

		# Synchronize with waveform plot.
		marker_plot.index_range = self.index_range

		self.vplot_container.add(marker_plot)
開發者ID:0,項目名稱:SpanishAcquisition,代碼行數:30,代碼來源:waveform.py

示例6: _create_plot_component

def _create_plot_component():

    # Create some x-y data series to plot
    x = linspace(-2.0, 10.0, 100)
    pd = ArrayPlotData(index = x)
    for i in range(5):
        pd.set_data("y" + str(i), jn(i,x))

    # Create some line plots of some of the data
    plot1 = Plot(pd, padding=50)
    plot1.plot(("index", "y0", "y1", "y2"), name="j_n, n<3", color="red")
    plot1.plot(("index", "y3"), name="j_3", color="blue")

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

    # Add the scrollbar
    hscrollbar = PlotScrollBar(component=plot1, axis="index", resizable="h",
                               height=15)
    plot1.padding_top = 0
    hscrollbar.force_data_update()

    # Create a container and add our plots
    container = VPlotContainer()
    container.add(plot1)
    container.add(hscrollbar)

    return container
開發者ID:BenChristenson,項目名稱:chaco,代碼行數:30,代碼來源:scrollbar.py

示例7: _create_plot_component

def _create_plot_component(obj):
    # Setup the spectrum plot
    frequencies = linspace(0.0, float(SAMPLING_RATE)/2, num=NUM_SAMPLES/2)
    obj.spectrum_data = ArrayPlotData(frequency=frequencies)
    empty_amplitude = zeros(NUM_SAMPLES/2)
    obj.spectrum_data.set_data('amplitude', empty_amplitude)

    obj.spectrum_plot = Plot(obj.spectrum_data)
    spec_renderer = obj.spectrum_plot.plot(("frequency", "amplitude"), name="Spectrum",
                           color="red")[0]
    obj.spectrum_plot.padding = 50
    obj.spectrum_plot.title = "Spectrum"
    spec_range = list(obj.spectrum_plot.plots.values())[0][0].value_mapper.range
    spec_range.low = 0.0
    spec_range.high = 5.0
    obj.spectrum_plot.index_axis.title = 'Frequency (hz)'
    obj.spectrum_plot.value_axis.title = 'Amplitude'

    # Time Series plot
    times = linspace(0.0, float(NUM_SAMPLES)/SAMPLING_RATE, num=NUM_SAMPLES)
    obj.time_data = ArrayPlotData(time=times)
    empty_amplitude = zeros(NUM_SAMPLES)
    obj.time_data.set_data('amplitude', empty_amplitude)

    obj.time_plot = Plot(obj.time_data)
    obj.time_plot.plot(("time", "amplitude"), name="Time", color="blue")
    obj.time_plot.padding = 50
    obj.time_plot.title = "Time"
    obj.time_plot.index_axis.title = 'Time (seconds)'
    obj.time_plot.value_axis.title = 'Amplitude'
    time_range = list(obj.time_plot.plots.values())[0][0].value_mapper.range
    time_range.low = -0.2
    time_range.high = 0.2

    # Spectrogram plot
    values = [zeros(NUM_SAMPLES/2) for i in range(SPECTROGRAM_LENGTH)]
    p = WaterfallRenderer(index = spec_renderer.index, values = values,
            index_mapper = LinearMapper(range = obj.spectrum_plot.index_mapper.range),
            value_mapper = LinearMapper(range = DataRange1D(low=0, high=SPECTROGRAM_LENGTH)),
            y2_mapper = LinearMapper(low_pos=0, high_pos=8,
                            range=DataRange1D(low=0, high=15)),
            )
    spectrogram_plot = p
    obj.spectrogram_plot = p
    dummy = Plot()
    dummy.padding = 50
    dummy.index_axis.mapper.range = p.index_mapper.range
    dummy.index_axis.title = "Frequency (hz)"
    dummy.add(p)

    container = HPlotContainer()
    container.add(obj.spectrum_plot)
    container.add(obj.time_plot)

    c2 = VPlotContainer()
    c2.add(dummy)
    c2.add(container)

    return c2
開發者ID:enthought,項目名稱:chaco,代碼行數:59,代碼來源:spec_waterfall.py

示例8: ChacoReporter

class ChacoReporter(StateDataReporter, HasTraits):
    plots = Instance(VPlotContainer)
    labels = List

    traits_view = View(
        Group(Item('plots', editor=ComponentEditor(), show_label=False)),
        width=800, height=600, resizable=True,
        title='OpenMM')

    def construct_plots(self):
        """Build the Chaco Plots. This will be run on the first report
        """
        self.labels = super(ChacoReporter, self)._headers()

        self.plots = VPlotContainer(resizable="hv", bgcolor="lightgray",
                                    fill_padding=True, padding=10)
        # this looks cryptic, but it is equivalent to
        # ArrayPlotData(a=[], b=[], c=[])
        # if the keys are a,b,c. This just does it for all of the keys.
        self.plotdata = ArrayPlotData(**dict(zip(self.labels,
                                      [[]]*len(self.labels))))

        # figure out which key will be the x axis

        x = None
        x_labels = ['Time (ps)', 'Step']
        for possible_x in x_labels:
            if possible_x in self.labels:
                x = possible_x
                break
        if x is None:
            raise ValueError('The reporter published neither the step nor time'
                'count, so I don\'t know what to plot on the x-axis!')

        colors = itertools.cycle(['blue', 'green', 'silver', 'pink', 'lightblue',
                                  'red', 'darkgray', 'lightgreen'])

        for y in set(self.labels).difference(x_labels):
            self.plots.add(chaco_scatter(self.plotdata, x_name=x, y_name=y,
                                         color=colors.next()))

    def _constructReportValues(self, simulation, state):
        values = super(ChacoReporter, self)._constructReportValues(simulation, state)

        for i, label in enumerate(self.labels):
            current = self.plotdata.get_data(label)
            self.plotdata.set_data(label, np.r_[current, float(values[i])])

        return values

    def report(self, simulation, state):
        if not self._hasInitialized:
            self.construct_plots()
        super(ChacoReporter, self).report(simulation, state)
開發者ID:rmcgibbo,項目名稱:OpenMM-tools,代碼行數:54,代碼來源:chacoreporter.py

示例9: normal_left_dclick

    def normal_left_dclick(self, event):
        plot = Plot(self.data)
        for data, kw in self.command_queue:
            plot.plot(data, **kw)
            plot.title = self.title

        plot.title = self.title
        container = VPlotContainer(bgcolor=WindowColor)
        container.add(plot)
        plot.tools.append(PanTool(plot))
        plot.overlays.append(ZoomTool(plot))
        window = PlotWindow(plot=container)
        window.edit_traits(kind='live', parent=event.window.control)
開發者ID:5n1p,項目名稱:chaco,代碼行數:13,代碼來源:popupable_plot.py

示例10: _create_plot_component_vertical

 def _create_plot_component_vertical(signals=Array,
                                     use_downsampling=False):
 
     # container = HPlotContainer(resizable = "hv", bgcolor="lightgray",
     #                            fill_padding=True, padding = 10)
     container = VPlotContainer(resizable="hv", bgcolor="lightgray",
                                fill_padding=True, padding=50)
 
     nSignal, nSample = np.shape(signals)
     time = arange(nSample)
 
     value_range = None
     plots = {}
     for i in range(nSignal):
 
         plot = create_line_plot((time, signals[i]),
                         color=tuple(COLOR_PALETTE[i % len(COLOR_PALETTE)]),
                         width=1.0,
                         # orientation="v")
                         orientation="h")
         plot.origin_axis_visible = True
         # plot.origin = "top left"
         plot.padding_left = 10
         plot.padding_right = 10
         plot.border_visible = False
         plot.bgcolor = "white"
         if value_range is None:
             value_range = plot.value_mapper.range
         else:
             plot.value_range = value_range
             value_range.add(plot.value)
 
         container.add(plot)
         plots["Corr fun %d" % i] = plot
 
     # Add a legend in the upper right corner, and make it relocatable
     legend = Legend(component=plot, padding=10, align="ur")
     legend.tools.append(LegendTool(legend, drag_button="right"))
     plot.overlays.append(legend)
     legend.plots = plots
     # container.padding_top = 50
     container.overlays.append(PlotLabel("Correlation function",
                                         component=container,
                                         font="swiss 16",
                                         overlay_position="top"))
     # selection_overlay = RangeSelectionOverlay(component=plot)
     # plot.tools.append(RangeSelection(plot))
     zoom = ZoomTool(plot, tool_mode="box", always_on=False)
     # plot.overlays.append(selection_overlay)
     plot.overlays.append(zoom)
     return container
開發者ID:lucearth,項目名稱:MIIC-library,代碼行數:51,代碼來源:plot_fun.py

示例11: _composite_plot_default

    def _composite_plot_default(self):

        line_plot = Plot(self.plotdata)
        line_plot.plot(('x', 'y'), type='line', color='blue')

        img_plot = Plot(self.plotdata)
        img_plot.img_plot("zdata",
                          xbounds='x_range',
                          ybounds='y_range',
                          colormap=jet)

        cp = VPlotContainer()
        cp.add(img_plot)
        cp.add(line_plot)
        return cp
開發者ID:PlamenStilyianov,項目名稱:Python,代碼行數:15,代碼來源:mvc_plot.py

示例12: _container_default

    def _container_default(self):
        plot = Plot(self.dataset)
        plot.plot( ('dates', self.data_provider.code), type='line')

        # Add tools
        plot.tools.append(ZoomTool(plot))
        plot.tools.append(PanTool(plot))

        # Set the plot's bottom axis to use the Scales ticking system
        ticker = ScalesTickGenerator(scale=CalendarScaleSystem())
        plot.x_axis.tick_generator = ticker

        container = VPlotContainer()
        container.add(plot)

        return container
開發者ID:enthought,項目名稱:euroscipy_2013_chaco_tutorial,代碼行數:16,代碼來源:solution_4_multi_plot.py

示例13: construct_plots

    def construct_plots(self):
        """Build the Chaco Plots. This will be run on the first report
        """
        self.labels = super(ChacoReporter, self)._headers()

        self.plots = VPlotContainer(resizable="hv", bgcolor="lightgray",
                                    fill_padding=True, padding=10)
        # this looks cryptic, but it is equivalent to
        # ArrayPlotData(a=[], b=[], c=[])
        # if the keys are a,b,c. This just does it for all of the keys.
        self.plotdata = ArrayPlotData(**dict(zip(self.labels,
                                      [[]]*len(self.labels))))

        # figure out which key will be the x axis

        x = None
        x_labels = ['Time (ps)', 'Step']
        for possible_x in x_labels:
            if possible_x in self.labels:
                x = possible_x
                break
        if x is None:
            raise ValueError('The reporter published neither the step nor time'
                'count, so I don\'t know what to plot on the x-axis!')

        colors = itertools.cycle(['blue', 'green', 'silver', 'pink', 'lightblue',
                                  'red', 'darkgray', 'lightgreen'])

        for y in set(self.labels).difference(x_labels):
            self.plots.add(chaco_scatter(self.plotdata, x_name=x, y_name=y,
                                         color=colors.next()))
開發者ID:rmcgibbo,項目名稱:OpenMM-tools,代碼行數:31,代碼來源:chacoreporter.py

示例14: create_plots

    def create_plots(self, keys):
        """Create the plots

        Paramters
        ---------
        keys : list of strings
            A list of all of the keys in the msg dict. This should be something
            like ['Step', 'Temperature', 'Potential Energy']. We'll create the
            ArrayPlotData container in which each of these timeseries will
            get put.
        """

        self.plots = VPlotContainer(resizable = "hv", bgcolor="lightgray",
                               fill_padding=True, padding = 10)
        # this looks cryptic, but it is equivalent to
        # ArrayPlotData(a=[], b=[], c=[])
        # if the keys are a,b,c. This just does it for all of the keys.
        self.plotdata = ArrayPlotData(**dict(zip(keys, [[]]*len(keys))))

        # figure out which key will be the x axis
        if 'Step' in keys:
            x = 'Step'
        elif 'Time (ps)' in keys:
            x = 'Time (ps)'
        else:
            raise ValueError('The reporter published neither the step nor time'
                'count, so I don\'t know what to plot on the x-axis!')


        colors = itertools.cycle(['blue', 'green', 'silver', 'pink', 'lightblue',
                                  'red', 'darkgray', 'lightgreen',])
        for y in filter(lambda y: y != x, keys):
            self.plots.add(chaco_scatter(self.plotdata, x_name=x, y_name=y,
                                         color=colors.next()))
開發者ID:rmcgibbo,項目名稱:openmm-builder,代碼行數:34,代碼來源:runner.py

示例15: __init__

    def __init__(self):
        # 首先需要調用父類的初始化函數
        super(TriangleWave, self).__init__()

        # 創建繪圖數據集,暫時沒有數據因此都賦值為空,隻是創建幾個名字,以供Plot引用
        self.plot_data = ArrayPlotData(x=[], y=[], f=[], p=[], x2=[], y2=[]) 

        # 創建一個垂直排列的繪圖容器,它將頻譜圖和波形圖上下排列
        self.container = VPlotContainer()

        # 創建波形圖,波形圖繪製兩條曲線: 原始波形(x,y)和合成波形(x2,y2)
        self.plot_wave = self._create_plot(("x","y"), "Triangle Wave")
        self.plot_wave.plot(("x2","y2"), color="red")

        # 創建頻譜圖,使用數據集中的f和p
        self.plot_fft  = self._create_plot(("f","p"), "FFT", type="scatter")

        # 將兩個繪圖容器添加到垂直容器中
        self.container.add( self.plot_wave )
        self.container.add( self.plot_fft )

        # 設置
        self.plot_wave.x_axis.title = "Samples"
        self.plot_fft.x_axis.title = "Frequency pins"
        self.plot_fft.y_axis.title = "(dB)"

        # 改變fftsize為1024,因為Enum的默認缺省值為枚舉列表中的第一個值
        self.fftsize = 1024
開發者ID:paulsaturn,項目名稱:linux_test,代碼行數:28,代碼來源:test_fft_tri.py


注:本文中的chaco.api.VPlotContainer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。