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


Python OverlayPlotContainer.my方法代碼示例

本文整理匯總了Python中enthought.chaco.api.OverlayPlotContainer.my方法的典型用法代碼示例。如果您正苦於以下問題:Python OverlayPlotContainer.my方法的具體用法?Python OverlayPlotContainer.my怎麽用?Python OverlayPlotContainer.my使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在enthought.chaco.api.OverlayPlotContainer的用法示例。


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

示例1: _create_draggable_plot_component

# 需要導入模塊: from enthought.chaco.api import OverlayPlotContainer [as 別名]
# 或者: from enthought.chaco.api.OverlayPlotContainer import my [as 別名]
def _create_draggable_plot_component(title, initial_values=None,  on_change_functor=None):

    container = OverlayPlotContainer(padding = 30, fill_padding = True,
                                     bgcolor = "lightgray", use_backbuffer=True)


    if initial_values:
        x = initial_values[0]
        y = initial_values[1]
    else:
        # Create the initial X-series of data
        numpoints = 30
        low = -5
        high = 15.0
        x = linspace(low, high, numpoints)
        y = jn(0, x)

    lineplot = create_line_plot((x, y), color=tuple(COLOR_PALETTE[0]),
                                width=2.0)
    lineplot.selected_color = 'none'

    scatter = ScatterPlot(
        index=lineplot.index,
        value=lineplot.value,
        index_mapper=lineplot.index_mapper,
        value_mapper=lineplot.value_mapper,
        color=tuple(COLOR_PALETTE[0]),
        marker_size=2,
        )
    scatter.index.sort_order = 'ascending'
    scatter.bgcolor = 'white'
    scatter.border_visible = True

    add_default_grids(scatter)
    add_default_axes(scatter)
    scatter.tools.append(PanTool(scatter, drag_button='right'))

    # The ZoomTool tool is stateful and allows drawing a zoom
    # box to select a zoom region.
    zoom = ZoomTool(scatter, tool_mode='box', always_on=False,
                    drag_button=None)
    scatter.overlays.append(zoom)

    point_dragging_tool = PointDraggingTool(scatter)
    point_dragging_tool.on_change_functor = on_change_functor
    scatter.tools.append(point_dragging_tool)

    container.add(lineplot)
    container.add(scatter)
    # Add the title at the top
    container.overlays.append(PlotLabel(title, component=container,
                              font='swiss 16', overlay_position='top'))

    container.mx = lineplot.index.get_data()
    container.my = lineplot.value.get_data()

    container.lineplot = lineplot
    return container
開發者ID:NeuroArchive,項目名稱:morphforge,代碼行數:60,代碼來源:chaco_util.py


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