def add_guide(self, value, orientation='h', plotid=0, color=(0, 0, 0)): """ """ plot = self.plots[plotid] from pychron.graph.guide_overlay import GuideOverlay guide_overlay = GuideOverlay(component=plot, value=value, color=color) plot.overlays.append(guide_overlay)
def _add_rule(self, v, orientation, plotid=0, add_move_tool=False, **kw): if 'plot' in kw: plot = kw['plot'] else: plot = self.plots[plotid] from pychron.graph.guide_overlay import GuideOverlay, GuideOverlayMoveTool l = GuideOverlay(plot, value=v, orientation=orientation, **kw) plot.underlays.append(l) if add_move_tool: plot.tools.append(GuideOverlayMoveTool(overlay=l)) return l
def new_series(self, x=None, y=None, plotid=0, **kw): ''' ''' plot, scatter, _line = super(ResidualsGraph, self).new_series(x=x, y=y, plotid=plotid, **kw) for underlay in plot.underlays: if underlay.orientation == 'bottom': underlay.visible = False underlay.padding_bottom = 0 plot.padding_bottom = 0 x, y, res = self.calc_residuals(plotid=plotid) ressplit = self._split_residual(x, res) resneg = ArrayDataSource(ressplit[1]) xneg = ArrayDataSource(ressplit[0]) respos = ArrayDataSource(ressplit[3]) xpos = ArrayDataSource(ressplit[2]) yrange = DataRange1D(ArrayDataSource(res)) ymapper = LinearMapper(range=yrange) container = self._container_factory(type='o', padding=[50, 15, 0, 30], height=75, resizable='h') bar = BarPlot( index=xneg, value=resneg, index_mapper=scatter.index_mapper, value_mapper=ymapper, bar_width=0.2, line_color='blue', fill_color='blue', border_visible=True, ) # left_axis = PlotAxis(bar, orientation = 'left') # bottom_axis=PlotAxis(bar,orientaiton='bottom') kw = dict(vtitle='residuals') if self.xtitle: kw['htitle'] = self.xtitle add_default_axes(bar, **kw) hgrid = PlotGrid(mapper=ymapper, component=bar, orientation='horizontal', line_color='lightgray', line_style='dot') bar.underlays.append(hgrid) # bar.underlays.append(left_axis) # bar.underlays.append(bottom_axis) bar2 = BarPlot( index=xpos, value=respos, index_mapper=scatter.index_mapper, value_mapper=ymapper, bar_width=0.2, line_color='green', fill_color='green', # bgcolor = 'green', resizable='hv', border_visible=True, # padding = [30, 5, 0, 30] ) bar2.overlays.append(GuideOverlay(bar2, value=0, color=(0, 0, 0))) bar2.underlays.append(hgrid) container.add(bar) container.add(bar2) # container.add(PlotLabel('foo')) self.residual_plots = [bar, bar2] self.plotcontainer.add(container)