def add_one(self, data, x=None, y=None, title=None): """ Add a data series to this lattice. :param data: A sequence of data suitable for constructing a :class:`.Series`, or a sequence of such objects. :param x: See :class:`.Series`. :param y: See :class:`.Series`. :param title: A title to render above this chart. """ series = Series(data, self._shape, x=x, y=y, name=title) for dimension in DIMENSIONS: if self._types[dimension]: if series._types[dimension] is not self._types[dimension]: raise TypeError( 'All data series must have the same data types.') else: self._types[dimension] = series._types[dimension] self._series.append(series)
def add_lines(self, data, x=None, y=None, name=None, color=None, width=None): """ Create and add a :class:`.Series` rendered with :class:`.Lines`. """ if not color: color = self._series_colors.pop(0) self.add_series(Series(data, Lines(color, width), x=x, y=y, name=name))
def add_dots(self, data, x=None, y=None, name=None, color=None, radius=None): """ Create and add a :class:`.Series` rendered with :class:`.Dots`. """ if not color: color = self._series_colors.pop(0) self.add_series(Series(data, Dots(color, radius), x=x, y=y, name=name))
def add_columns(self, data, x=None, y=None, name=None, color=None): """ Create and add a :class:`.Series` rendered with :class:`.Columns`. """ if not color: color = self._series_colors.pop(0) self.add_series(Series(data, Columns(color), x=x, y=y, name=name))
def add_line(self, data, x=None, y=None, name=None, stroke_color=None, width=None): """ Create and add a :class:`.Series` rendered with :class:`.Line`. """ self.add_series( Series(data, x=x, y=y, name=name), Line(stroke_color, width) )
def add_dots(self, data, x=None, y=None, name=None, fill_color=None, radius=None): """ Create and add a :class:`.Series` rendered with :class:`.Dots`. """ self.add_series( Series(data, x=x, y=y, name=name), Dots(fill_color, radius) )
def add_columns(self, data, x=None, y=None, name=None, fill_color=None): """ Create and add a :class:`.Series` rendered with :class:`.Columns`. """ self.add_series( Series(data, x=x, y=y, name=name), Columns(fill_color) )
def add_bars(self, data, x=None, y=None, name=None, fill_color=None): """ Create and add a :class:`.Series` rendered with :class:`.Bars`. Note that when creating bars in this way the order of the series data will be reversed so that the first item in the series is displayed as the top-most bar in the graphic. If you don't want this to happen use :meth:`.Chart.add_series` instead. """ self.add_series(Series(list(reversed(data)), x=x, y=y, name=name), Bars(fill_color))