本文整理匯總了Python中pychron.graph.graph.Graph.add_horizontal_rule方法的典型用法代碼示例。如果您正苦於以下問題:Python Graph.add_horizontal_rule方法的具體用法?Python Graph.add_horizontal_rule怎麽用?Python Graph.add_horizontal_rule使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pychron.graph.graph.Graph
的用法示例。
在下文中一共展示了Graph.add_horizontal_rule方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _graph_grid
# 需要導入模塊: from pychron.graph.graph import Graph [as 別名]
# 或者: from pychron.graph.graph.Graph import add_horizontal_rule [as 別名]
def _graph_grid(self, x, y, z, ze, r, reg, refresh):
self.min_j = min(z)
self.max_j = max(z)
g = self.graph
layout = FigureLayout(fixed='square')
nrows, ncols = layout.calculate(len(x))
if not isinstance(g, Graph):
g = Graph(container_dict={'bgcolor': 'gray',
'kind': 'g',
'shape': (nrows, ncols)})
self.graph = g
def get_ip(xi, yi):
return next(
(ip for ip in self.monitor_positions if ((ip.x - xi) ** 2 + (ip.y - yi) ** 2) ** 0.5 < 0.01), None)
opt = self.plotter_options
monage = opt.monitor_age * 1e6
lk = opt.lambda_k
ans = self._analyses[0]
scale = opt.flux_scalar
for r in range(nrows):
for c in range(ncols):
idx = c + ncols * r
if refresh:
try:
yy = z[idx] * scale
ye = ze[idx] * scale
except IndexError:
continue
if hasattr(g, 'rules'):
l1, l2, l3 = g.rules[idx]
l1.value = yy
l2.value = yy + ye
l3.value = yy - ye
g.refresh()
else:
plot = g.new_plot(padding_left=65, padding_right=5, padding_top=30, padding_bottom=5)
try:
ip = get_ip(x[idx], y[idx])
except IndexError:
continue
add_axes_tools(g, plot)
yy = z[idx] * scale
ye = ze[idx] * scale
plot.title = 'Identifier={} Position={}'.format(ip.identifier, ip.hole_id)
plot.x_axis.visible = False
if c == 0 and r == nrows // 2:
plot.y_axis.title = 'J x{}'.format(scale)
if not ip.use:
continue
# get ip via x,y
ais = [a for a in ans if a.irradiation_position == ip.hole_id]
n = len(ais)
# plot mean value
l1 = g.add_horizontal_rule(yy, color='black', line_style='solid', plotid=idx)
l2 = g.add_horizontal_rule(yy + ye, plotid=idx)
l3 = g.add_horizontal_rule(yy - ye, plotid=idx)
if hasattr(g, 'rules'):
g.rules.append((l1, l2, l3))
else:
g.rules = [(l1, l2, l3)]
# plot individual analyses
fs = [a.model_j(monage, lk) * scale for a in ais]
fs = sorted(fs)
iys = array([nominal_value(fi) for fi in fs])
ies = array([std_dev(fi) for fi in fs])
s, _p = g.new_series(linspace(0, n - 1, n), iys, yerror=ies, type='scatter',
marker='circle', marker_size=3)
g.set_x_limits(0, n - 1, pad='0.1', plotid=idx)
g.set_y_limits(min(iys - ies), max(iys + ies), pad='0.1', plotid=idx)
ebo = ErrorBarOverlay(component=s, orientation='y')
s.underlays.append(ebo)
s.error_bars = ebo
add_analysis_inspector(s, ais)
s.index.on_trait_change(self._grid_update_graph_metadata(ais), 'metadata_changed')
self.suppress_metadata_change = True
sel = [i for i, a in enumerate(ais) if a.is_omitted()]
s.index.metadata['selections'] = sel
self.suppress_metadata_change = False