def _render(self, gc, points, icon_mode=False): """ This same method is used both to render the scatterplot and to draw just the iconified version of this plot, with the latter simply requiring that a few steps be skipped. """ if not icon_mode: gc.save_state() gc.clip_to_rect(self.x, self.y, self.width, self.height) render_variable_size_markers(gc, points, self.marker, self.marker_size, self.color_, self.line_width, self.outline_color_, self.custom_symbol) if self._cached_selected_pts is not None and len(self._cached_selected_pts) > 0: sel_pts = self.map_screen(self._cached_selected_pts) render_markers(gc, sel_pts, self.selection_marker, self.selection_marker_size, self.selection_color_, self.selection_line_width, self.selection_outline_color_, self.custom_symbol) if not icon_mode: # Draw the default axes, if necessary self._draw_default_axes(gc) gc.restore_state()
def overlay(self, other_component, gc, view_bounds=None, mode="normal"): if self.label: self.label.font.face_name = '' with gc: oc = other_component gc.clip_to_rect(oc.x, oc.y, oc.x2, oc.y2) points = self._gather_data() #print points, self.x, self.y marker = self.marker color = self._color line_width = 1 outline_color = self._color if marker != 'vertical': marker_size = 3 render_markers(gc, points, marker, marker_size, color, line_width, outline_color) else: render_vertical_marker(gc, points, color, line_width, outline_color) x, y = self.get_current_point() e = self.error / 2.0 * max(1, self.nsigma) p1, p2 = self.component.map_screen([(self.x - e, 0), (self.x + e, 0)]) render_error_bar(gc, p1[0], p2[0], y, self._color, end_caps=self.end_cap_length) for o in self.overlays: o.overlay(other_component, gc, view_bounds=view_bounds, mode=mode)
def _render_marker_at_indices(self, gc, screen_pts, prefix, sep="_"): """ screen_pt should always be a list """ if len(screen_pts) == 0: return plot = self.component mapped_attribs = ("color", "outline_color", "marker") other_attribs = ("marker_size", "line_width") kwargs = {} for attr in mapped_attribs + other_attribs: if attr in mapped_attribs: # Resolve the mapped trait valname = attr + "_" else: valname = attr tmp = getattr(self, prefix + sep + valname) if tmp is not None: kwargs[attr] = tmp else: kwargs[attr] = getattr(plot, valname) # If the marker type is 'custom', we have to pass in the custom_symbol # kwarg to render_markers. if kwargs.get("marker", None) == "custom": kwargs["custom_symbol"] = plot.custom_symbol with gc: gc.clip_to_rect(plot.x, plot.y, plot.width, plot.height) render_markers(gc, screen_pts, **kwargs)
def _render_marker_at_indices(self, gc, screen_pts, prefix, sep="_"): """ screen_pt should always be a list """ if len(screen_pts) == 0: return plot = self.component mapped_attribs = ("color", "outline_color", "marker") other_attribs = ("marker_size", "line_width") kwargs = {} for attr in mapped_attribs + other_attribs: if attr in mapped_attribs: # Resolve the mapped trait valname = attr + "_" else: valname = attr tmp = getattr(self, prefix + sep + valname) if tmp is not None: kwargs[attr] = tmp else: kwargs[attr] = getattr(plot, valname) # If the marker type is 'custom', we have to pass in the custom_symbol # kwarg to render_markers. if kwargs.get("marker", None) == "custom": kwargs["custom_symbol"] = plot.custom_symbol with gc: gc.clip_to_rect(plot.x, plot.y, plot.width, plot.height) render_markers(gc, screen_pts, **kwargs)
def overlay(self, other_component, gc, view_bounds=None, mode="normal"): with gc: oc = other_component gc.clip_to_rect(oc.x, oc.y, oc.x2, oc.y2) points = self._gather_data() marker = self.marker color = self._color line_width = 1 outline_color = self._color if marker != 'vertical': marker_size = 3 render_markers(gc, points, marker, marker_size, color, line_width, outline_color) else: render_vertical_marker(gc, points, color, line_width, outline_color) x, y = self.get_current_point() e = self.error * max(1, self.nsigma) p1, p2 = self.component.map_screen([(self.x - e, 0), (self.x + e, 0)]) render_error_bar(gc, p1[0], p2[0], y, self._color, end_caps=self.end_cap_length) for o in self.overlays: o.overlay(other_component, gc, view_bounds=view_bounds, mode=mode)
def overlay(self, other_component, gc, view_bounds=None, mode="normal"): if self._points: with gc: pts = self.component.map_screen(self._points) render_markers(gc, pts[1:], 'circle', 3, (0, 1, 0), 1, (0, 1, 0)) render_markers(gc, pts[:1], 'circle', 3, (1, 1, 0), 1, (1, 1, 0))
def overlay(self, other_component, gc, view_bounds=None, mode="normal"): with gc: pts = self.component.map_screen(self.data_position) render_markers(gc, pts, 'circle', 5, self.color_, 2, self.outline_color_)
def overlay(self, other_component, gc, view_bounds=None, mode="normal"): with gc: pts = self.component.map_screen(self.data_position) render_markers(gc, pts, 'circle', 5, self.color_, 2, self.outline_color_)
def overlay(self, other_component, gc, view_bounds=None, mode="normal"): with gc: pts = self.component.map_screen([self.point]) render_markers(gc, pts, 'circle', 3, 'green', 1, 'green')
def overlay(self, other_component, gc, view_bounds=None, mode="normal"): with gc: pts = self.component.map_screen([self.point]) render_markers(gc, pts, 'circle', 3, 'green', 1, 'green')
def overlay(self, other_component, gc, view_bounds=None, mode="normal"): if self._points: with gc: pts = self.component.map_screen(self._points) render_markers(gc, pts[1:], 'circle', 3, (0, 1, 0), 1, (0, 1, 0)) render_markers(gc, pts[:1], 'circle', 3, (1, 1, 0), 1, (1, 1, 0))