def add_limit_tool(self, plot, orientation, handler=None): from pychron.graph.tools.limits_tool import LimitsTool from pychron.graph.tools.limits_tool import LimitOverlay t = LimitsTool(component=plot, orientation=orientation) o = LimitOverlay(component=plot, tool=t) plot.tools.insert(0, t) plot.overlays.append(o) if handler: t.on_trait_change(handler, 'limits_updated')
def _add_limit_tool(self, plot, orientation): t = LimitsTool(component=plot, orientation=orientation) o = LimitOverlay(component=plot, tool=t) plot.tools.append(t) plot.overlays.append(o)
def _add_limit_tool(self, plot): """ add tool for dragging the limits of the graph :param plot: Plot """ t = LimitsTool(component=plot, orientation='x') o = LimitOverlay(component=plot, tool=t) plot.tools.append(t) plot.overlays.append(o)
from numpy import * d = os.path.dirname(os.getcwd()) sys.path.append(d) from pychron.core.ui import set_toolkit set_toolkit('qt4') from pychron.graph.graph import Graph from pychron.graph.tools.limits_tool import LimitsTool, LimitOverlay xs = linspace(0, pi * 2) ys = cos(xs) g = Graph() p = g.new_plot() g.new_series(xs, ys) t = LimitsTool(component=p) o = LimitOverlay(component=p, tool=t) p.tools.append(t) p.overlays.append(o) t = LimitsTool(component=p, orientation='y') o = LimitOverlay(component=p, tool=t) p.tools.append(t) p.overlays.append(o) g.configure_traits()