本文整理汇总了Python中enthought.chaco.api.OverlayPlotContainer.mx方法的典型用法代码示例。如果您正苦于以下问题:Python OverlayPlotContainer.mx方法的具体用法?Python OverlayPlotContainer.mx怎么用?Python OverlayPlotContainer.mx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enthought.chaco.api.OverlayPlotContainer
的用法示例。
在下文中一共展示了OverlayPlotContainer.mx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_draggable_plot_component
# 需要导入模块: from enthought.chaco.api import OverlayPlotContainer [as 别名]
# 或者: from enthought.chaco.api.OverlayPlotContainer import mx [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