本文整理匯總了Python中enthought.chaco.api.VPlotContainer.remove方法的典型用法代碼示例。如果您正苦於以下問題:Python VPlotContainer.remove方法的具體用法?Python VPlotContainer.remove怎麽用?Python VPlotContainer.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類enthought.chaco.api.VPlotContainer
的用法示例。
在下文中一共展示了VPlotContainer.remove方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Plots
# 需要導入模塊: from enthought.chaco.api import VPlotContainer [as 別名]
# 或者: from enthought.chaco.api.VPlotContainer import remove [as 別名]
class Plots(HasTraits):
'''
Main work horse. Model of the data.
'''
container = Instance(VPlotContainer)
container_view = View(Item('container', editor=ComponentEditor(), show_label=False, width = 1000, height = 400),
width = 1000, height = 400, resizable=True)
#*************************************__init__()*************************************
def __init__(self, model, ui, extension, parent):
'''
Constructor
'''
self.model = model
self.ui = ui
self.extension = extension
self.parent = parent
self.plots = {}
self.renderers = {}
self.hidden = False
self.time_src = ArrayDataSource([])
self.container = VPlotContainer(bgcolor = "white",
fill_padding=True,
border_visible=False,
stack_order = 'top_to_bottom')
self.setup_plots()
self.pc = self.edit_traits(view='container_view', parent=parent, kind='subpanel').control
parent.layout.addWidget(self.pc)
self.pc.setParent(parent)
#*************************************update_plots()*************************************
def update_plots(self, pc):
'''
Args:
Returns:
Raises:
'''
ann = pc.data_dict["annotations"]
t0 = ann.get_value("START")
t1 = ann.get_value("STOP")
tug = ann.get_value("TURN_AROUND")
delta = t1 - t0
total = delta.seconds + delta.microseconds * 10**(-6)
self.time_src.set_data([0, total])
t2 = tug-t0
t2 = t2.seconds + t2.microseconds * 10**(-6)
self.x_axis.labels = ["START", "TURN_AROUND", "5s", "STOP"]
self.x_axis.positions = [0,
t2,
5,
total]
for name, plot in self.plots.items():
plot_conactory = plot.plot_conactory
res = pc.results[name[:-3]] # to remove the extension
print res
data_src = plot_conactory.datasources.get("index")
data_src.set_data(res[0])
data_src = plot_conactory.datasources.get(name)
data_src.set_data(res[1])
#*************************************create_plot()*************************************
def create_plot(self, name, ylabel="", color="blue"):
'''
Args:
Returns:
Raises:
'''
p = PlotContainer(name, self, self.time_src)
p.plot_conactory.y_axis.title = ylabel
self.plots[name] = p
p.plot_data.set_data(name, [])
renderer, = p.plot_conactory.plot(("index", name), name=name, color=color, line_width=1.5)
self.renderers[name] = renderer
self.container.add(p.plot_conactory)
#*************************************setup_plots()*************************************
def setup_plots(self):
'''
Args:
Returns:
Raises:
'''
ext = self.extension
#.........這裏部分代碼省略.........