当前位置: 首页>>代码示例>>Python>>正文


Python HPlotContainer.bgcolor方法代码示例

本文整理汇总了Python中enthought.chaco.api.HPlotContainer.bgcolor方法的典型用法代码示例。如果您正苦于以下问题:Python HPlotContainer.bgcolor方法的具体用法?Python HPlotContainer.bgcolor怎么用?Python HPlotContainer.bgcolor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在enthought.chaco.api.HPlotContainer的用法示例。


在下文中一共展示了HPlotContainer.bgcolor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _create_plot_component

# 需要导入模块: from enthought.chaco.api import HPlotContainer [as 别名]
# 或者: from enthought.chaco.api.HPlotContainer import bgcolor [as 别名]
def _create_plot_component():

    # Create some data
    numpts = 1000
    x = sort(random(numpts))
    y = random(numpts)
    color = exp(-(x**2 + y**2))

    # Create a plot data obect and give it this data
    pd = ArrayPlotData()
    pd.set_data("index", x)
    pd.set_data("value", y)
    pd.set_data("color", color)

    # Create the plot
    plot = Plot(pd)
    plot.plot(("index", "value", "color"),
              type="cmap_scatter",
              name="my_plot",
              color_mapper=jet,
              marker = "square",
              fill_alpha = 0.5,
              marker_size = 6,
              outline_color = "black",
              border_visible = True,
              bgcolor = "white")

    # Tweak some of the plot properties
    plot.title = "Colormapped Scatter Plot"
    plot.padding = 50
    plot.x_grid.visible = False
    plot.y_grid.visible = False
    plot.x_axis.font = "modern 16"
    plot.y_axis.font = "modern 16"

    # Right now, some of the tools are a little invasive, and we need the
    # actual ColomappedScatterPlot object to give to them
    cmap_renderer = plot.plots["my_plot"][0]

    # Attach some tools to the plot
    plot.tools.append(PanTool(plot, constrain_key="shift"))
    zoom = ZoomTool(component=plot, tool_mode="box", always_on=False)
    plot.overlays.append(zoom)
    selection = ColormappedSelectionOverlay(cmap_renderer, fade_alpha=0.35,
                                            selection_type="mask")
    cmap_renderer.overlays.append(selection)

    # Create the colorbar, handing in the appropriate range and colormap
    colorbar = create_colorbar(plot.color_mapper)
    colorbar.plot = cmap_renderer
    colorbar.padding_top = plot.padding_top
    colorbar.padding_bottom = plot.padding_bottom

    # Create a container to position the plot and the colorbar side-by-side
    container = HPlotContainer(use_backbuffer = True)
    container.add(plot)
    container.add(colorbar)
    container.bgcolor = "lightgray"
    return container
开发者ID:brycehendrix,项目名称:chaco,代码行数:61,代码来源:cmap_scatter.py

示例2: _create_plot_component

# 需要导入模块: from enthought.chaco.api import HPlotContainer [as 别名]
# 或者: from enthought.chaco.api.HPlotContainer import bgcolor [as 别名]
 def _create_plot_component(self):
     
     # Create a plot data object and give it this data
     self.pd = ArrayPlotData()
     self.pd.set_data("imagedata", self.data[self.data_name])
 
     # Create the plot
     self.tplot = Plot(self.pd, default_origin="top left")
     self.tplot.x_axis.orientation = "top"
     self.tplot.img_plot("imagedata", 
                   name="my_plot",
                   #xbounds=(0,10),
                   #ybounds=(0,10),
                   colormap=jet)
 
     # Tweak some of the plot properties
     self.tplot.title = "Matrix"
     self.tplot.padding = 50
 
     # Right now, some of the tools are a little invasive, and we need the 
     # actual CMapImage object to give to them
     self.my_plot = self.tplot.plots["my_plot"][0]
 
     # Attach some tools to the plot
     self.tplot.tools.append(PanTool(self.tplot))
     zoom = ZoomTool(component=self.tplot, tool_mode="box", always_on=False)
     self.tplot.overlays.append(zoom)
     
     # my custom tool to get the connection information
     self.custtool = CustomTool(self.tplot)
     self.tplot.tools.append(self.custtool)
 
     # Create the colorbar, handing in the appropriate range and colormap
     colormap = self.my_plot.color_mapper
     self.colorbar = ColorBar(index_mapper=LinearMapper(range=colormap.range),
                         color_mapper=colormap,
                         plot=self.my_plot,
                         orientation='v',
                         resizable='v',
                         width=30,
                         padding=20)
         
     self.colorbar.padding_top = self.tplot.padding_top
     self.colorbar.padding_bottom = self.tplot.padding_bottom
     
     # create a range selection for the colorbar
     self.range_selection = RangeSelection(component=self.colorbar)
     self.colorbar.tools.append(self.range_selection)
     self.colorbar.overlays.append(RangeSelectionOverlay(component=self.colorbar,
                                                    border_color="white",
                                                    alpha=0.8,
                                                    fill_color="lightgray"))
 
     # we also want to the range selection to inform the cmap plot of
     # the selection, so set that up as well
     self.range_selection.listeners.append(self.my_plot)
 
     # Create a container to position the plot and the colorbar side-by-side
     container = HPlotContainer(use_backbuffer = True)
     container.add(self.tplot)
     container.add(self.colorbar)
     container.bgcolor = "white"
 
     return container
开发者ID:neurodebian,项目名称:connectomeviewer,代码行数:66,代码来源:matrix_viewer_old.py

示例3: _create_plot_component

# 需要导入模块: from enthought.chaco.api import HPlotContainer [as 别名]
# 或者: from enthought.chaco.api.HPlotContainer import bgcolor [as 别名]
def _create_plot_component():
    # Create a scalar field to colormap# Create a scalar field to colormap
    xbounds = (-2*pi, 2*pi, 600)
    ybounds = (-1.5*pi, 1.5*pi, 300)
    xs = linspace(*xbounds)
    ys = linspace(*ybounds)
    x, y = meshgrid(xs,ys)
    z = jn(2, x)*y*x

    # Create a plot data obect and give it this data
    pd = ArrayPlotData()
    pd.set_data("imagedata", z)

    # Create the plot
    plot = Plot(pd)
    plot.img_plot("imagedata",
                  name="my_plot",
                  xbounds=xbounds[:2],
                  ybounds=ybounds[:2],
                  colormap=jet)

    # Tweak some of the plot properties
    plot.title = "Selectable Image Plot"
    plot.padding = 50

    # Right now, some of the tools are a little invasive, and we need the
    # actual CMapImage object to give to them
    my_plot = plot.plots["my_plot"][0]

    # 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)

    # Create the colorbar, handing in the appropriate range and colormap
    colormap = my_plot.color_mapper
    colorbar = ColorBar(index_mapper=LinearMapper(range=colormap.range),
                        color_mapper=colormap,
                        plot=my_plot,
                        orientation='v',
                        resizable='v',
                        width=30,
                        padding=20)
    colorbar.padding_top = plot.padding_top
    colorbar.padding_bottom = plot.padding_bottom

    # create a range selection for the colorbar
    range_selection = RangeSelection(component=colorbar)
    colorbar.tools.append(range_selection)
    colorbar.overlays.append(RangeSelectionOverlay(component=colorbar,
                                                   border_color="white",
                                                   alpha=0.8,
                                                   fill_color="lightgray"))

    # we also want to the range selection to inform the cmap plot of
    # the selection, so set that up as well
    range_selection.listeners.append(my_plot)

    # Create a container to position the plot and the colorbar side-by-side
    container = HPlotContainer(use_backbuffer = True)
    container.add(plot)
    container.add(colorbar)
    container.bgcolor = "lightgray"

    #my_plot.set_value_selection((-1.3, 6.9))

    return container
开发者ID:brycehendrix,项目名称:chaco,代码行数:69,代码来源:cmap_image_select.py

示例4: _create_plot_component

# 需要导入模块: from enthought.chaco.api import HPlotContainer [as 别名]
# 或者: from enthought.chaco.api.HPlotContainer import bgcolor [as 别名]
def _create_plot_component(file_name):
    # Create a scalar field to colormap
    z = load(file_name)
    pd = ArrayPlotData()
    pd.set_data("imagedata", z)
    
    # Create the plot
    plot = Plot(pd)
    plot.bgcolor = 'gray'
    
    img_plot = plot.img_plot("imagedata",
                             name='my_plot', 
                             colormap=jet,
                             hide_grids=True)[0]
    #cont_plot=plot.contour_plot('imagedata', type='line', name='countour')
    # Tweak some of the plot properties
    #plot.title = file_name
    plot.padding = 40
    plot.padding_right=20
    # Attach some tools to the plot
    plot.tools.append(PanTool(plot))
    #plot.tools.append(TraitsTool(plot))
    zoom = ZoomTool(component=img_plot, tool_mode="box", always_on=False)
    img_plot.overlays.append(zoom)
    #plot.y_axis.tick_label_formatter = lambda x: "%.3e" % x
    #plot.x_axis.tick_label_formatter = lambda x: "%.3e" % x
    #plot.tools.append(SaveTool(plot))
    # Right now, some of the tools are a little invasive, and we need the
    # actual CMapImage object to give to them
    my_plot = img_plot#plot.plots["my_plot"][0]
    colormap = my_plot.color_mapper
    colorbar = ColorBar(index_mapper=LinearMapper(range=colormap.range),
                        color_mapper=colormap,
                        plot=my_plot,
                        orientation='v',
                        resizable='v',
                        width=25,
                        padding=0)
    colorbar.origin = 'bottom left'
    #colorbar._axis.tick_label_formatter = lambda x: '%.0e'%(x*10e6) + u' [\u00b5' + 'Watt]'
    colorbar._axis.tick_label_formatter = lambda x: ('%.0e'%(x*1e6))
    colorbar._axis.orientation = 'right'
    colorbar._axis.title = u'Intensity [\u00b5W]'
    colorbar.padding_top = plot.padding_top
    colorbar.padding_bottom = plot.padding_bottom
    colorbar.padding_right = 100
    # create a range selection for the colorbar
    range_selection = RangeSelection(component=colorbar)
    colorbar.tools.append(range_selection)
    colorbar.overlays.append(RangeSelectionOverlay(component=colorbar,
                                                   border_color="white",
                                                   alpha=0.5,
                                                   fill_color="lightgray"))
    
    range_selection.listeners.append(my_plot)
    
    imgtool = ImageInspectorTool(img_plot)
    img_plot.tools.append(imgtool)
    plot.overlays.append(ImageInspectorOverlay(component=img_plot, image_inspector=imgtool))
    # we also want to the range selection to inform the cmap plot of
    # the selection, so set that up as well

    # Create a container to position the plot and the colorbar side-by-side
    container = HPlotContainer(use_backbuffer = True)
    container.add(plot)
    container.add(colorbar)
    container.bgcolor = "white"
    container.tools.append(SaveTool(container))
    container.tools.append(TraitsTool(container))
    #my_plot.set_value_selection((-1.3, 6.9))
    return container    
开发者ID:semode,项目名称:LabDevices,代码行数:73,代码来源:NumpyFileViewer.py


注:本文中的enthought.chaco.api.HPlotContainer.bgcolor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。