# Scales

class `leather.``Scale`

  Bases: `object`

  Base class for various kinds of scale objects.

  `contains`(v)

    Return `True` if a given value is contained within this scale’s displayed domain.

  `format_tick`(value, i, count)

    Format ticks for display.

    This method is used as a default which will be ignored if the user provides a custom tick formatter to the axis.

  classmethod `infer`(layers, dimension, data_type)

    Infer’s an appropriate default scale for a given sequence of `Series`.

    Parameters:

    - chart_series – A sequence of `Series` instances
    - dimension – The dimension, `X` or `Y` of the data to infer for.
    - data_type – The type of data contained in the series dimension.

  `project`(value, range_min, range_max)

    Project a value in this scale’s domain to a target range.

  `project_interval`(value, range_min, range_max)

    Project a value in this scale’s domain to an interval in the target range. This is used for places `Bars` and `Columns`.

  `ticks`()

    Generate a series of ticks for this scale.

class `leather.``Linear`(domain_min, domain_max)

  Bases: `leather.scales.base.Scale`

  A scale that linearly maps values from a domain to a range.

  Parameters:

  - domain_min – The minimum value of the input domain.
  - domain_max – The maximum value of the input domain.

  `contains`(v)

    Return `True` if a given value is contained within this scale’s domain.

  `project`(value, range_min, range_max)

    Project a value in this scale’s domain to a target range.

  `project_interval`(value, range_min, range_max)

    Project a value in this scale’s domain to an interval in the target range. This is used for places `Bars` and `Columns`.

  `ticks`()

    Generate a series of ticks for this scale.

class `leather.``Ordinal`(domain)

  Bases: `leather.scales.base.Scale`

  A scale that maps individual values (e.g. strings) to a range.

  `contains`(v)

    Return `True` if a given value is contained within this scale’s displayed domain.

  `project`(value, range_min, range_max)

    Project a value in this scale’s domain to a target range.

  `project_interval`(value, range_min, range_max)

    Project a value in this scale’s domain to an interval in the target range. This is used for places `Bars` and `Columns`.

  `ticks`()

    Generate a series of ticks for this scale.

class `leather.``Temporal`(domain_min, domain_max)

  Bases: `leather.scales.base.Scale`

  A scale that linearly maps date/datetime values from a domain to a range.

  Parameters:

  - domain_min – The minimum date/datetime of the input domain.
  - domain_max – The maximum date/datetime of the input domain.

  `contains`(v)

    Return `True` if a given value is contained within this scale’s domain.

  `format_tick`(value, i, count)

    Format ticks for display.

    This method is used as a default which will be ignored if the user provides a custom tick formatter to the axis.

  `project`(value, range_min, range_max)

    Project a value in this scale’s domain to a target range.

  `project_interval`(value, range_min, range_max)

    Project a value in this scale’s domain to an interval in the target range. This is used for places `Bars` and `Columns`.

  `ticks`()

    Generate a series of ticks for this scale.