How to use the chaco.data_range_1d.DataRange1D function in chaco

To help you get started, we’ve selected a few chaco examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NMGRL / pychron / pychron / pipeline / plot / overlays / base_inset.py View on Github external
def __init__(self, xs, ys, index_bounds=None, value_bounds=None, *args, **kw):
        index = ArrayDataSource(xs)
        value = ArrayDataSource(ys)
        if index_bounds is not None:
            index_range = DataRange1D(low=index_bounds[0], high=index_bounds[1])
        else:
            index_range = DataRange1D()
        index_range.add(index)
        index_mapper = LinearMapper(range=index_range)
        index_range.tight_bounds = False
        if value_bounds is not None:
            value_range = DataRange1D(low=value_bounds[0], high=value_bounds[1])
        else:
            value_range = DataRange1D()
        value_range.add(value)
        value_mapper = LinearMapper(range=value_range)
        value_range.tight_bounds = False

        self.index = index
        self.value = value
        self.index_mapper = index_mapper
        self.value_mapper = value_mapper
        # self.color = "red"
        # self.line_width = 1.0
        # self.line_style = "solid"

        super(BaseInset, self).__init__(*args, **kw)

        tick_label_font = 'Helvetica 8'
        left = PlotAxis(orientation='left',
github NMGRL / pychron / pychron / pipeline / plot / overlays / base_inset.py View on Github external
def __init__(self, xs, ys, index_bounds=None, value_bounds=None, *args, **kw):
        index = ArrayDataSource(xs)
        value = ArrayDataSource(ys)
        if index_bounds is not None:
            index_range = DataRange1D(low=index_bounds[0], high=index_bounds[1])
        else:
            index_range = DataRange1D()
        index_range.add(index)
        index_mapper = LinearMapper(range=index_range)
        index_range.tight_bounds = False
        if value_bounds is not None:
            value_range = DataRange1D(low=value_bounds[0], high=value_bounds[1])
        else:
            value_range = DataRange1D()
        value_range.add(value)
        value_mapper = LinearMapper(range=value_range)
        value_range.tight_bounds = False

        self.index = index
        self.value = value
        self.index_mapper = index_mapper
        self.value_mapper = value_mapper
        # self.color = "red"
        # self.line_width = 1.0
        # self.line_style = "solid"

        super(BaseInset, self).__init__(*args, **kw)
github enthought / chaco / chaco / plot.py View on Github external
if isinstance(colormap, AbstractColormap):
                self.color_mapper = colormap
                if colormap.range is None:
                    color_range.add(color)
                    colormap.range = color_range

            elif callable(colormap):
                color_range.add(color)
                self.color_mapper = colormap(color_range)
            else:
                raise ValueError("Unexpected colormap %r in plot()." % colormap)

            if self.color_mapper is not None and self.color_mapper.range is not None:
                color_range = self.color_mapper.range
            else:
                color_range = DataRange1D()

            if len(data) == 4:
                size = self._get_or_create_datasource(data[3])

                size_range = DataRange1D()
                size_range.add(size)
                size_min = styles.pop("size_min", 1)
                size_max = styles.pop("size_max", 10)

                sizemap = LinearMapper(low_pos=size_min, high_pos=size_max,
                            range=size_range)


            if self.index_scale == "linear":
                imap = LinearMapper(range=self.index_range,
                            stretch_data=self.index_mapper.stretch_data)
github NMGRL / pychron / pychron / pipeline / plot / overlays / base_inset.py View on Github external
def __init__(self, xs, ys, index_bounds=None, value_bounds=None, *args, **kw):
        index = ArrayDataSource(xs)
        value = ArrayDataSource(ys)
        if index_bounds is not None:
            index_range = DataRange1D(low=index_bounds[0], high=index_bounds[1])
        else:
            index_range = DataRange1D()
        index_range.add(index)
        index_mapper = LinearMapper(range=index_range)
        index_range.tight_bounds = False
        if value_bounds is not None:
            value_range = DataRange1D(low=value_bounds[0], high=value_bounds[1])
        else:
            value_range = DataRange1D()
        value_range.add(value)
        value_mapper = LinearMapper(range=value_range)
        value_range.tight_bounds = False

        self.index = index
        self.value = value
        self.index_mapper = index_mapper
github NMGRL / pychron / pychron / processing / plotters / base_inset.py View on Github external
def __init__(self, xs, ys, index_bounds=None, value_bounds=None, *args, **kw):
        index = ArrayDataSource(xs)
        value = ArrayDataSource(ys)
        if index_bounds is not None:
            index_range = DataRange1D(low=index_bounds[0], high=index_bounds[1])
        else:
            index_range = DataRange1D()
        index_range.add(index)
        index_mapper = LinearMapper(range=index_range)
        index_range.tight_bounds = False
        if value_bounds is not None:
            value_range = DataRange1D(low=value_bounds[0], high=value_bounds[1])
        else:
            value_range = DataRange1D()
        value_range.add(value)
        value_mapper = LinearMapper(range=value_range)
        value_range.tight_bounds = False

        self.index = index
        self.value = value
        self.index_mapper = index_mapper
        self.value_mapper = value_mapper
        # self.color = "red"
        # self.line_width = 1.0
        # self.line_style = "solid"

        super(BaseInset, self).__init__(*args, **kw)