cowpatch.text_elements

Module Contents

Classes

text

create a new text object

class cowpatch.text_elements.text(label, element_text=None, theme=None)[source]

create a new text object

Parameters
  • label (string) – text label with desirable format (e.g. sympy, etc.)

  • element_text (plotnine.themes.elements.element_text) – element object from plotnine, can also be added later

  • theme (plotnine.theme object) – theme object from plotnine, can be associated later should only provide a theme or element_text (as a theme contains an element_text)

Notes

This class leverages matplotlib to create the text (given that matplotlib can create path-style objects for text if the individual is worried that the svg text visually won’t be preserved - this is also annoying that this is the default).

Note the function use the text attribute - NOT the plot_title attribute if a theme is provided.

save(filename, width=None, height=None)[source]

save text object as image in minimal size object

Parameters
  • filename (str) –

  • width (float) – in inches (if None, then tight (w.r.t. to margins))

  • height (float) – in inches (if None, then tight (w.r.t. to margins))