40
42
These are the 'y' coordinates.
42
44
value : instance of a MultiArrayDataSource
43
Note that the `scale`, `offset` and `amplitude` attributes of the
45
Note that the `scale`, `offset` and `normalized_amplitude` attributes of the
44
46
MultiArrayDataSource control the projection of the traces into the (x,y)
45
plot. In simplest case, `scale=1` and `offset=0`, and `amplitude` controls
46
the scaling of the traces relative to their base y value.
47
plot. In simplest case, `scale=1` and `offset=0`, and `normalized_amplitude`
48
controls the scaling of the traces relative to their base y value.
50
global_min, global_max : float
51
The minimum and maximum values of the data in `value`. For large
52
arrays, computing these could take excessive time, so they must be
53
provided when an instance is created.
55
normalized_amplitude : Float
137
144
#------------------------------------------------------------------------
139
146
# The projected 2D numpy array.
140
_trace_data = Property(Array, depends_on=['index', 'value', 'yindex',
141
'amplitude', 'scale', 'offset'])
147
_trace_data = Property(Array, depends_on=['index', 'index.data_changed',
148
'value', 'value.data_changed', 'yindex', 'yindex.data_changed',
149
'amplitude', 'scale', 'offset'])
143
151
# Cached list of non-NaN arrays of (x,y) data-space points; regardless of
144
152
# self.orientation, this is always stored as (index_pt, value_pt). This is
193
201
def _get_amplitude_scale(self):
195
203
If the amplitude is set to this value, the largest trace deviation from
196
is base y coordinates will be equal to the y coordinate spacing.
204
its base y coordinate will be equal to the y coordinate spacing.
198
206
# Note: Like the rest of the current code, this ignores the `scale` attribute.
380
388
if len(line_points) == 0:
384
gc.set_antialias(True)
385
gc.clip_to_rect(self.x, self.y, self.width, self.height)
387
render = self._render_normal
389
if selected_points is not None:
390
gc.set_stroke_color(self.selected_color_)
391
gc.set_line_width(self.line_width+10.0)
392
gc.set_line_dash(self.selected_line_style_)
393
render(gc, selected_points)
395
if self.color_func is not None:
396
# Existence of self.color_func overrides self.color.
397
color_func = self.color_func
399
color_func = lambda k: self.color_
401
tmp = list(enumerate(line_points))
402
# Note: the list is reversed for testing with _render_filled.
403
for k, points in reversed(tmp):
404
color = color_func(k)
405
gc.set_stroke_color(color)
406
gc.set_line_width(self.line_width)
407
gc.set_line_dash(self.line_style_)
410
# Draw the default axes, if necessary
411
self._draw_default_axes(gc)
392
gc.set_antialias(True)
393
gc.clip_to_rect(self.x, self.y, self.width, self.height)
395
render = self._render_normal
397
if selected_points is not None:
398
gc.set_stroke_color(self.selected_color_)
399
gc.set_line_width(self.line_width+10.0)
400
gc.set_line_dash(self.selected_line_style_)
401
render(gc, selected_points)
403
if self.color_func is not None:
404
# Existence of self.color_func overrides self.color.
405
color_func = self.color_func
407
color_func = lambda k: self.color_
409
tmp = list(enumerate(line_points))
410
# Note: the list is reversed for testing with _render_filled.
411
for k, points in reversed(tmp):
412
color = color_func(k)
413
gc.set_stroke_color(color)
414
gc.set_line_width(self.line_width)
415
gc.set_line_dash(self.line_style_)
418
# Draw the default axes, if necessary
419
self._draw_default_axes(gc)
415
421
def _render_normal(self, gc, points):
416
422
for ary in points:
424
430
def _render_icon(self, gc, x, y, width, height):
426
gc.set_stroke_color(self.color_)
427
gc.set_line_width(self.line_width)
428
gc.set_line_dash(self.line_style_)
430
gc.move_to(x, y+height/2)
431
gc.line_to(x+width, y+height/2)
432
gc.set_stroke_color(self.color_)
433
gc.set_line_width(self.line_width)
434
gc.set_line_dash(self.line_style_)
436
gc.move_to(x, y+height/2)
437
gc.line_to(x+width, y+height/2)
438
441
def _alpha_changed(self):