Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# Shapes

class leather.Shape

  Bases: `object`

  Base class for shapes that can be used to render data `Series`.

  validate_series(series)

    Verify this shape can be used to render a given series.

  to_svg(width, height, x_scale, y_scale, series, palette)

    Render this shape to an SVG.

  legend_to_svg(series, palette)

    Render the legend entries for these shapes.

class leather.Bars(fill_color=None)

  Bases: `Shape`

  Render a series of data as bars.

  Parameters:

    fill_color – The color to fill the bars. You may also specify a `style_function()`.

  validate_series(series)

    Verify this shape can be used to render a given series.

  to_svg(width, height, x_scale, y_scale, series, palette)

    Render bars to SVG elements.

class leather.Columns(fill_color=None)

  Bases: `Shape`

  Render a series of data as columns.

  Parameters:

    fill_color – The color to fill the columns. You may also specify a `style_function()`.

  validate_series(series)

    Verify this shape can be used to render a given series.

  to_svg(width, height, x_scale, y_scale, series, palette)

    Render columns to SVG elements.

class leather.Dots(fill_color=None, radius=None)

  Bases: `Shape`

  Render a series of data as dots.

  Parameters:

    - fill_color – The color to fill the dots. You may also specify a `style_function()`. If not specified, default chart colors will be used.

    - radius – The radius of the rendered dots. Defaults to `theme.default_dot_radius`. You may also specify a `style_function()`.

  validate_series(series)

    Verify this shape can be used to render a given series.

  to_svg(width, height, x_scale, y_scale, series, palette)

    Render dots to SVG elements.

  legend_to_svg(series, palette)

    Render the legend entries for these shapes.

class leather.Line(stroke_color=None, width=None, stroke_dasharray=None)

  Bases: `Shape`

  Render a series of data as a line.

  Parameters:

    - stroke_color – The color to stroke the lines. If not provided, default chart colors will be used.

    - width – The width of the lines. Defaults to `theme.default_line_width`.

  validate_series(series)

    Verify this shape can be used to render a given series.

  to_svg(width, height, x_scale, y_scale, series, palette)

    Render lines to SVG elements.

leather.style_function(datum)

  This example shows how to define a function to specify style values for individual data points.

  Parameters:

    datum – A `Datum` instance for the data row.