cowpatch.utils

Module Contents

Functions

val_range(x)

is_int(x)

is_positive(x)

is_non_neg_int(x)

is_pos_int(x)

is_proportion(x)

is_non_negative(x)

inherits(object, _class)

to_pt(value, units[, dpi])

convert length from given units to pt

from_pt(value, units[, dpi])

convert length from pt to given units

to_inches(value, units[, dpi])

convert length from given units to pt

from_inches(value, units[, dpi])

convert length from inches to given units

inherits_plotnine(other)

checks if object is a plotnine one (but really only checks if comes

cowpatch.utils.val_range(x)[source]
cowpatch.utils.is_int(x)[source]
cowpatch.utils.is_positive(x)[source]
cowpatch.utils.is_non_neg_int(x)[source]
cowpatch.utils.is_pos_int(x)[source]
cowpatch.utils.is_proportion(x)[source]
cowpatch.utils.is_non_negative(x)[source]
cowpatch.utils.inherits(object, _class)[source]
cowpatch.utils.to_pt(value, units, dpi=96)[source]

convert length from given units to pt

Parameters
  • value (float) – length in measurement units

  • units (str) – unit type (e.g. “pt”, “px”, “in”, “cm”, “mm”)

  • dpi (float / int) – dots per inch (conversion between inches and px)

Return type

length in pt

cowpatch.utils.from_pt(value, units, dpi=96)[source]

convert length from pt to given units

Parameters
  • value (float) – length in pt

  • units (str) – unit type (e.g. “pt”, “px”, “in”, “cm”, “mm”) to convert to

  • dpi (float / int) – dots per inch (conversion between inches and px)

Return type

length given units

cowpatch.utils.to_inches(value, units, dpi=96)[source]

convert length from given units to pt

Parameters
  • value (float) – length in measurement units

  • units (str) – unit type (e.g. “pt”, “px”, “in”, “cm”, “mm”)

  • dpi (float / int) – dots per inch (conversion between inches and px)

Return type

length in pt

cowpatch.utils.from_inches(value, units, dpi=96)[source]

convert length from inches to given units

Parameters
  • value (float) – length in inches

  • units (str) – unit type (e.g. “pt”, “px”, “in”, “cm”, “mm”) to convert to

  • dpi (float / int) – dots per inch (conversion between inches and px)

Return type

length given units

cowpatch.utils.inherits_plotnine(other)[source]

checks if object is a plotnine one (but really only checks if comes from plotnine package…)