本文整理匯總了Python中pychron.graph.graph.Graph.clear方法的典型用法代碼示例。如果您正苦於以下問題:Python Graph.clear方法的具體用法?Python Graph.clear怎麽用?Python Graph.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pychron.graph.graph.Graph
的用法示例。
在下文中一共展示了Graph.clear方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: passive_focus
# 需要導入模塊: from pychron.graph.graph import Graph [as 別名]
# 或者: from pychron.graph.graph.Graph import clear [as 別名]
def passive_focus(self, block=False, **kw):
self._evt_autofocusing = TEvent()
self._evt_autofocusing.clear()
# manager = self.laser_manager
oper = self.parameters.operator
self.info('passive focus. operator = {}'.format(oper))
g = self.graph
if not g:
g = Graph(plotcontainer_dict=dict(padding=10),
window_x=0.70,
window_y=20,
window_width=325,
window_height=325,
window_title='Autofocus'
)
self.graph = g
g.clear()
g.new_plot(padding=[40, 10, 10, 40],
xtitle='Z (mm)',
ytitle='Focus Measure ({})'.format(oper)
)
g.new_series()
g.new_series()
invoke_in_main_thread(self._open_graph)
target = self._passive_focus
self._passive_focus_thread = Thread(name='autofocus', target=target,
args=(self._evt_autofocusing,
),
kwargs=kw
)
self._passive_focus_thread.start()
if block:
# while 1:
# if not self._passive_focus_thread.isRunning():
# break
# time.sleep(0.25)
self._passive_focus_thread.join()
示例2: _graph_hole_vs_j
# 需要導入模塊: from pychron.graph.graph import Graph [as 別名]
# 或者: from pychron.graph.graph.Graph import clear [as 別名]
def _graph_hole_vs_j(self, x, y, r, reg, refresh):
sel = [i for i, (a, x, y, e) in enumerate(zip(*self._analyses)) if a.is_omitted()]
g = self.graph
if not isinstance(g, Graph):
g = Graph(container_dict={'bgcolor': self.plotter_options.bgcolor})
self.graph = g
po = self.plotter_options
is_matching = po.model_kind == 'Matching'
ys = reg.ys
xs = arctan2(x, y)
yserr = reg.yserr
lyy = ys - yserr
uyy = ys + yserr
a = max((abs(min(xs)), abs(max(xs))))
fxs = linspace(-a, a)
a = r * sin(fxs)
b = r * cos(fxs)
pts = vstack((a, b)).T
fys = reg.predict(pts)
if not is_matching:
try:
l, u = reg.calculate_error_envelope(fxs, rmodel=fys)
except BaseException:
l, u = reg.calculate_error_envelope(pts, rmodel=fys)
if not refresh:
g.clear()
p = g.new_plot(xtitle='Hole (Theta)',
ytitle='J',
# padding=[90, 5, 5, 40],
padding=po.paddings())
p.bgcolor = po.plot_bgcolor
add_axes_tools(g, p)
def label_fmt(xx):
return floatfmt(xx, n=2, s=4, use_scientific=True)
p.y_axis.tick_label_formatter = label_fmt
# plot fit line
# plot0 == line
if not is_matching:
line, _p = g.new_series(fxs, fys)
ee = ErrorEnvelopeOverlay(component=line,
xs=fxs, lower=l, upper=u)
line.error_envelope = ee
line.underlays.append(ee)
# plot the individual analyses
# plot1 == scatter
iscatter, iys = self._graph_individual_analyses()
# plot means
# plot2 == scatter
scatter, _ = g.new_series(xs, ys,
yerror=yserr,
type='scatter',
marker_size=4, marker='diamond')
ebo = ErrorBarOverlay(component=scatter,
orientation='y')
scatter.underlays.append(ebo)
scatter.error_bars = ebo
add_inspector(scatter, self._additional_info)
ymi = min(lyy.min(), min(iys))
yma = max(uyy.max(), max(iys))
g.set_x_limits(-3.5, 3.5)
g.set_y_limits(ymi, yma, pad='0.1')
# set metadata last because it will trigger a refresh
self.suppress_metadata_change = True
iscatter.index.metadata['selections'] = sel
self.suppress_metadata_change = False
# add a legend
if not is_matching:
labels = [('plot1', 'Individual'),
('plot2', 'Mean'),
('plot0', 'Fit'),
]
else:
labels = [('plot0', 'Individual'),
('plot1', 'Mean')]
legend = ExplicitLegend(plots=self.graph.plots[0].plots,
labels=labels)
p.overlays.append(legend)
else:
plot = g.plots[0]
#.........這裏部分代碼省略.........