~ubuntu-branches/ubuntu/utopic/python-chaco/utopic

« back to all changes in this revision

Viewing changes to chaco/multi_line_plot.py

  • Committer: Package Import Robot
  • Author(s): Andrew Starr-Bochicchio
  • Date: 2014-06-01 17:04:08 UTC
  • mfrom: (7.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20140601170408-m86xvdjd83a4qon0
Tags: 4.4.1-1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
 - Let the binary-predeb target work on the usr/lib/python* directory
   as we don't have usr/share/pyshared anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
    value : instance of a MultiArrayDataSource
41
41
        Note that the `scale`, `offset` and `normalized_amplitude` attributes of the
42
 
        MultiArrayDataSource control the projection of the traces into the (x,y)
 
42
        MultiLinePlot control the projection of the traces into the (x,y)
43
43
        plot.  In simplest case, `scale=1` and `offset=0`, and `normalized_amplitude`
44
44
        controls the scaling of the traces relative to their base y value.
45
45
 
209
209
 
210
210
        if len(coordinates) > 1:
211
211
            dy = coordinates[1] - coordinates[0]
 
212
            if dy == 0:
 
213
                dy = 1.0
212
214
        else:
213
215
            # default coordinate spacing if there is only 1 coordinate
214
216
            dy = 1.0
407
409
            # Note: the list is reversed for testing with _render_filled.
408
410
            for k, points in reversed(tmp):
409
411
                color = color_func(k)
 
412
                # Apply the alpha
 
413
                alpha = color[-1] if len(color) == 4 else 1
 
414
                color = color[:3] + (alpha * self.alpha,)
410
415
                gc.set_stroke_color(color)
411
416
                gc.set_line_width(self.line_width)
412
417
                gc.set_line_dash(self.line_style_)
436
441
 
437
442
 
438
443
    def _alpha_changed(self):
439
 
        self.color_ = self.color_[0:3] + (self.alpha,)
440
444
        self.invalidate_draw()
441
445
        self.request_redraw()
442
446
        return
443
447
 
444
 
    def _default_color(self):
445
 
        return black_color_trait
446
 
 
447
448
    def _color_changed(self):
448
449
        self.invalidate_draw()
449
450
        self.request_redraw()