当前位置: 首页>>代码示例>>Python>>正文


Python Graph.set_data方法代码示例

本文整理汇总了Python中pychron.graph.graph.Graph.set_data方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.set_data方法的具体用法?Python Graph.set_data怎么用?Python Graph.set_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pychron.graph.graph.Graph的用法示例。


在下文中一共展示了Graph.set_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _graph_hole_vs_j

# 需要导入模块: from pychron.graph.graph import Graph [as 别名]
# 或者: from pychron.graph.graph.Graph import set_data [as 别名]

#.........这里部分代码省略.........
        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]

            s1 = plot.plots['plot1' if is_matching else 'plot2'][0]
            s1.yerror.set_data(yserr)
            s1.error_bars.invalidate()

            g.set_data(ys, plotid=0, series=1 if is_matching else 2, axis=1)

            if not is_matching:
                l1 = plot.plots['plot0'][0]
                l1.error_envelope.trait_set(xs=fxs, lower=l, upper=u)
                l1.error_envelope.invalidate()
                g.set_data(fys, plotid=0, series=0, axis=1)

            s2 = plot.plots['plot1' if is_matching else 'plot0'][0]
            s2.index.metadata['selections'] = sel

        self.max_j = fys.max()
        self.min_j = fys.min()
开发者ID:NMGRL,项目名称:pychron,代码行数:104,代码来源:flux_visualization_editor.py


注:本文中的pychron.graph.graph.Graph.set_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。