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


Python HPlotContainer.bgcolor方法代码示例

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


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

示例1: _hist2d_default

# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from chaco.api.HPlotContainer import bgcolor [as 别名]
    def _hist2d_default(self):
        plot = Plot(self.hist2d_data, padding=(20, 0, 0, 40))
        plot.img_plot("H", xbounds=self.xedges, ybounds=self.yedges, colormap=jet)
        plot.index_axis.title = "Voxel dist."
        plot.value_axis.title = "Root Square Error"

        # Create a colorbar
        colormap = plot.color_mapper
        colorbar = ColorBar(index_mapper=LinearMapper(range=colormap.range),
                            color_mapper=colormap,
                            plot=plot,
                            orientation='v',
                            resizable='v',
                            width=20,
                            padding=(20, 30, 0, 0))
        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, padding=0)
        container.add(colorbar)
        container.add(plot)
        container.bgcolor = "lightgray"

        return container
开发者ID:MarcCote,项目名称:brainsearch,代码行数:27,代码来源:vizu_chaco.py

示例2: _plot_default

# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from chaco.api.HPlotContainer import bgcolor [as 别名]
  def _plot_default(self):
    plot = Plot(self.plotdata)
    plot.title = "Simplex on the Rosenbrock function"

    plot.img_plot("background",
                  name="background",
                  xbounds=(0,1.5),
                  ybounds=(0,1.5),
                  colormap=jet(DataRange1D(low=0,high=100)),
                  )

    plot.plot(("values_x", "values_y"), type="scatter", color="red")

    background = plot.plots["background"][0]

    colormap = background.color_mapper
    colorbar = ColorBar(index_mapper=LinearMapper(range=colormap.range),
                        color_mapper=colormap,
                        plot=background,
                        orientation='v',
                        resizable='v',
                        width=30,
                        padding=20)
    colorbar.padding_top = plot.padding_top
    colorbar.padding_bottom = plot.padding_bottom

    container = HPlotContainer(use_backbuffer = True)
    container.add(plot)
    container.add(colorbar)
    container.bgcolor = "lightgray"
    return container
开发者ID:cdsj,项目名称:scikit-optimization-tutorials,代码行数:33,代码来源:tutorial_simplex.py

示例3: _create_plot_component

# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from 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:BenChristenson,项目名称:chaco,代码行数:61,代码来源:cmap_scatter.py

示例4: _create_plot_component

# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from chaco.api.HPlotContainer import bgcolor [as 别名]
def _create_plot_component():
    # Load state data
    states = pandas.read_csv('states.csv')
    lon = (states['longitude'] + 180.) / 360.
    lat = numpy.radians(states['latitude'])
    lat = (1 - (1. - numpy.log(numpy.tan(lat) +
                               (1./numpy.cos(lat)))/numpy.pi)/2.0)

    populations = pandas.read_csv('state_populations.csv')
    data = populations['2010']
    lon = lon.view(numpy.ndarray)
    lat = lat.view(numpy.ndarray)
    data = data.view(numpy.ndarray)

    plot = Plot(ArrayPlotData(index = lon, value=lat, color=data))
    renderers = plot.plot(("index", "value", "color"),
              type = "cmap_scatter",
              name = "unfunded",
              color_mapper = OrRd,
              marker = "circle",
              outline_color = 'lightgray',
              line_width = 1.,
              marker_size = 10,
              )

    tile_cache = MBTileManager(filename = './map.mbtiles',
                               min_level = 2,
                               max_level = 4)
    # Need a better way add the overlays
    cmap = renderers[0]

    map = Map(cmap, tile_cache=tile_cache, zoom_level=3)
    cmap.underlays.append(map)
    
    plot.title = "2010 Population"
    plot.tools.append(PanTool(plot))
    plot.tools.append(ZoomTool(plot))

    plot.index_axis.title = "Longitude"
    plot.index_axis.tick_label_formatter = convert_lon
    plot.value_axis.title = "Latitude"
    plot.value_axis.tick_label_formatter = convert_lat

    cmap.overlays.append(
            ColormappedSelectionOverlay(cmap, fade_alpha=0.35,
                          selection_type="mask"))

    colorbar = create_colorbar(plot.color_mapper)
    colorbar.plot = cmap
    colorbar.padding_top = plot.padding_top
    colorbar.padding_bottom = plot.padding_bottom
    
    container = HPlotContainer(use_backbuffer = True)
    container.add(plot)
    container.add(colorbar)
    container.bgcolor = "lightgray"

    return container
开发者ID:bgrant,项目名称:enable-mapping,代码行数:60,代码来源:chaco_map.py

示例5: _create_plot_component

# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from chaco.api.HPlotContainer import bgcolor [as 别名]
def _create_plot_component(max_pop, index_ds, value_ds, color_ds, paths):

    tile_cache = HTTPTileManager(min_level=2, max_level=4,
                                 server='tile.cloudmade.com',
                                 url='/1a1b06b230af4efdbb989ea99e9841af/20760/256/%(zoom)d/%(col)d/%(row)d.png')  # noqa

    color_range = DataRange1D(color_ds, low_setting=0)

    choro = ChoroplethPlot(
              index=index_ds,
              value=value_ds,
              color_data=color_ds,
              index_mapper=LinearMapper(range=DataRange1D(index_ds)),
              value_mapper=LinearMapper(range=DataRange1D(value_ds)),
              color_mapper=colormap(range=color_range),
              outline_color='white',
              line_width=1.5,
              fill_alpha=1.,
              compiled_paths=paths,

              tile_cache=tile_cache,
              zoom_level=3,
              )

    container = OverlayPlotContainer(
        bgcolor='sys_window', padding=50, fill_padding=False,
        border_visible=True,
    )
    container.add(choro)

    for dir in ['left']:
        axis = PlotAxis(tick_label_formatter=convert_lat,
                        mapper=choro.value_mapper, component=container,
                        orientation=dir)
        container.overlays.append(axis)
    for dir in ['top', 'bottom']:
        axis = PlotAxis(tick_label_formatter=convert_lon,
                        mapper=choro.index_mapper, component=container,
                        orientation=dir)
        container.overlays.append(axis)

    choro.tools.append(PanTool(choro))
    choro.tools.append(ZoomTool(choro))

    colorbar = create_colorbar(choro)
    colorbar.padding_top = container.padding_top
    colorbar.padding_bottom = container.padding_bottom

    plt = HPlotContainer(use_backbuffer=True)
    plt.add(container)
    plt.add(colorbar)
    plt.bgcolor = "sys_window"

    return plt
开发者ID:enthought,项目名称:enable-mapping,代码行数:56,代码来源:choropleth.py

示例6: _brain_default

# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from chaco.api.HPlotContainer import bgcolor [as 别名]
    def _brain_default(self):
        plot = Plot(self.brain_data, padding=0)
        plot.width = self.brain_voxels.shape[1]
        plot.height = self.brain_voxels.shape[0]
        plot.aspect_ratio = 1.
        plot.index_axis.visible = False
        plot.value_axis.visible = False
        renderer = plot.img_plot("axial", colormap=gray)[0]
        plot.color_mapper.range = DataRange1D(low=0., high=1.0)
        plot.bgcolor = 'pink'

        # Brain tools
        plot.tools.append(PanTool(plot, drag_button="right"))
        plot.tools.append(ZoomTool(plot))
        imgtool = ImageInspectorTool(renderer)
        renderer.tools.append(imgtool)
        overlay = ImageInspectorOverlay(component=renderer, image_inspector=imgtool,
                                        bgcolor="white", border_visible=True)
        renderer.overlays.append(overlay)

        # Brain track cursor
        self.cursor = CursorTool2D(renderer, drag_button='left', color='red', line_width=2.0)
        #self.cursor.on_trait_change(self.update_stackedhist, 'current_index')
        self.cursor.current_positionyou = (0., 0.)
        renderer.overlays.append(self.cursor)

        # Brain colorbar
        colormap = plot.color_mapper
        colorbar = ColorBar(index_mapper=LinearMapper(range=colormap.range),
                            color_mapper=colormap,
                            plot=plot,
                            orientation='v',
                            resizable='v',
                            width=20,
                            padding=(30, 0, 0, 0))
        colorbar.padding_top = plot.padding_top
        colorbar.padding_bottom = plot.padding_bottom

        # Noisy brain
        plot2 = Plot(self.brain_data, padding=0)
        plot2.width = self.brain_voxels.shape[1]
        plot2.height = self.brain_voxels.shape[0]
        plot2.aspect_ratio = 1.
        plot2.index_axis.visible = False
        plot2.value_axis.visible = False
        renderer2 = plot2.img_plot("noisy_axial", colormap=gray)[0]
        plot2.color_mapper.range = DataRange1D(low=0., high=1.0)
        plot2.bgcolor = 'pink'
        plot2.range2d = plot.range2d

        # Brain_map tools
        plot2.tools.append(PanTool(plot2, drag_button="right"))
        plot2.tools.append(ZoomTool(plot2))
        imgtool2 = ImageInspectorTool(renderer2)
        renderer2.tools.append(imgtool2)
        overlay2 = ImageInspectorOverlay(component=renderer2, image_inspector=imgtool2,
                                         bgcolor="white", border_visible=True)
        renderer2.overlays.append(overlay2)

        # Brain_map track cursor
        self.cursor2 = CursorTool2D(renderer2, drag_button='left', color='red', line_width=2.0)
        #self.cursor2.on_trait_change(self.cursor2_changed, 'current_index')
        self.cursor2.current_position = (0., 0.)
        renderer2.overlays.append(self.cursor2)

        # Brain_map colorbar
        colormap2 = plot2.color_mapper
        colorbar2 = ColorBar(index_mapper=LinearMapper(range=colormap2.range),
                             color_mapper=colormap2,
                             plot=plot2,
                             orientation='v',
                             resizable='v',
                             width=20,
                             padding=(30, 0, 0, 0))
        colorbar2.padding_top = plot2.padding_top
        colorbar2.padding_bottom = plot2.padding_bottom

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

        container2 = HPlotContainer(use_backbuffer=True, padding=(0, 0, 10, 10))
        container2.add(plot2)
        container2.add(colorbar2)
        container2.bgcolor = "lightgray"

        Hcontainer = HPlotContainer(use_backbuffer=True)
        Hcontainer.add(container)
        Hcontainer.add(container2)
        Hcontainer.bgcolor = "lightgray"

        return Hcontainer
开发者ID:MarcCote,项目名称:brainsearch,代码行数:96,代码来源:vizu_chaco.py

示例7: _create_plot_component_cmap

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

    nSignal, nSample = np.shape(signals)

    xbounds = (1, nSample, nSample)
    ybounds = (1, nSignal, nSignal)
    z = signals

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

    return container
开发者ID:lucearth,项目名称:MIIC-library,代码行数:66,代码来源:plot_fun.py

示例8: _create_plot_component

# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from chaco.api.HPlotContainer import bgcolor [as 别名]
 def _create_plot_component(self):
     
     # we need the matrices!
     # start with the currently selected one
     #nr_nodes = self.matrix_data_ref[curr_edge].shape[0]
     
     # Create a plot data obect and give it this data
     self.pd = ArrayPlotData()
     self.pd.set_data("imagedata", self.matrix_data_ref[self.curr_edge])
 
     # 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,nr_nodes),
                   #ybounds=(0,nr_nodes),
                   colormap=jet)
 
     # Tweak some of the plot properties
     self.tplot.title = self.curr_edge
     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
     
     # TODO: the range selection gives a Segmentation Fault,
     # but why, the matrix_viewer.py example works just fine!
     # 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"
 
     # my_plot.set_value_selection((-1.3, 6.9))
 
     return container
开发者ID:151706061,项目名称:connectomeviewer,代码行数:74,代码来源:cmatrix_viewer.py

示例9: _create_plot_component

# 需要导入模块: from chaco.api import HPlotContainer [as 别名]
# 或者: from 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])
 
     # find dimensions
     xdim = self.data[self.data_name].shape[1]
     ydim = self.data[self.data_name].shape[0]
 
     # 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.5,xdim + 0.5),
                   ybounds=(0.5,ydim + 0.5),
                   colormap=jet)
 
     # Tweak some of the plot properties
     self.tplot.title = "Connection Matrix for %s" % self.data_name
     self.tplot.padding = 80
 
     # 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:151706061,项目名称:connectomeviewer,代码行数:70,代码来源:con_matrix_viewer.py


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