equal
deleted
inserted
replaced
582 y_data = items[1].GetData(start_tick, end_tick) |
582 y_data = items[1].GetData(start_tick, end_tick) |
583 |
583 |
584 # Search for the nearest point from mouse position |
584 # Search for the nearest point from mouse position |
585 if len(x_data) > 0 and len(y_data) > 0: |
585 if len(x_data) > 0 and len(y_data) > 0: |
586 length = min(len(x_data), len(y_data)) |
586 length = min(len(x_data), len(y_data)) |
587 d = numpy.sqrt((x_data[:length,1]-event.xdata) ** 2 + \ |
587 d = numpy.sqrt((x_data[:length, 1]-event.xdata) ** 2 + \ |
588 (y_data[:length,1]-event.ydata) ** 2) |
588 (y_data[:length, 1]-event.ydata) ** 2) |
589 |
589 |
590 # Set cursor tick to the tick of this point |
590 # Set cursor tick to the tick of this point |
591 cursor_tick = x_data[numpy.argmin(d), 0] |
591 cursor_tick = x_data[numpy.argmin(d), 0] |
592 |
592 |
593 # Graph is parallel |
593 # Graph is parallel |
597 |
597 |
598 # Search for point that tick is the nearest from mouse X position |
598 # Search for point that tick is the nearest from mouse X position |
599 # and set cursor tick to the tick of this point |
599 # and set cursor tick to the tick of this point |
600 if len(data) > 0: |
600 if len(data) > 0: |
601 cursor_tick = data[numpy.argmin( |
601 cursor_tick = data[numpy.argmin( |
602 numpy.abs(data[:,0] - event.xdata)), 0] |
602 numpy.abs(data[:, 0] - event.xdata)), 0] |
603 |
603 |
604 # Update cursor tick |
604 # Update cursor tick |
605 if cursor_tick is not None: |
605 if cursor_tick is not None: |
606 self.ParentWindow.SetCursorTick(cursor_tick) |
606 self.ParentWindow.SetCursorTick(cursor_tick) |
607 |
607 |
983 return text_func(*args, **kwargs) |
983 return text_func(*args, **kwargs) |
984 return AddText |
984 return AddText |
985 |
985 |
986 def SetAxesColor(self, color): |
986 def SetAxesColor(self, color): |
987 if LooseVersion(matplotlib.__version__) >= LooseVersion("1.5.0"): |
987 if LooseVersion(matplotlib.__version__) >= LooseVersion("1.5.0"): |
988 self.Axes.set_prop_cycle(cycler('color',color)) |
988 self.Axes.set_prop_cycle(cycler('color', color)) |
989 else: |
989 else: |
990 self.Axes.set_color_cycle(color) |
990 self.Axes.set_color_cycle(color) |
991 |
991 |
992 def ResetGraphics(self): |
992 def ResetGraphics(self): |
993 """ |
993 """ |