def __init__(self, *args, **kw): self.border_visible = kw.get('border_visible', True) BaseInset.__init__(self, *args, **kw) LinePlot.__init__(self) self.y_axis.trait_set(tick_label_formatter=lambda x: '', tick_visible=False)
def overlay(self, other_component, gc, view_bounds=None, mode="normal"): with gc: gc.clip_to_rect(0, 0, self.component.width, self.component.height) upts, lpts = self.get_screen_points() gc.set_line_dash((5, 5)) gc.set_stroke_color((1, 0, 0)) LinePlot._render_normal(gc, upts, '') LinePlot._render_normal(gc, lpts, '')
def __init__(self, *args, **kw): self.border_visible = kw.get('border_visible', True) BaseInset.__init__(self, *args, **kw) LinePlot.__init__(self) if not self.visible_axes: self.x_axis.visible = False self.y_axis.visible = False
def get_line_plot(render_style): prices = datasets.fetch_mldata('regression-datasets stock') x, y = get_data_sources(y=prices['data'][:70, 0]) x_mapper, y_mapper = get_mappers(x, y) line_plot = LinePlot(index=x, value=y, index_mapper=x_mapper, value_mapper=y_mapper, render_style=render_style, **PLOT_DEFAULTS) add_axes(line_plot, x_label='Days', y_label='Stock price') return line_plot
def get_line_plot(render_style): prng = np.random.RandomState(seed=1234) x_data = np.linspace(0, 10, 50) y_data = x_data**2 + prng.randn(50) x, y = get_data_sources(x=x_data, y=y_data) x_mapper, y_mapper = get_mappers(x, y) line_plot = LinePlot(index=x, value=y, index_mapper=x_mapper, value_mapper=y_mapper, render_style=render_style, **PLOT_DEFAULTS) add_axes(line_plot, x_label='x', y_label='y') return line_plot