draw#

class discopy.grammar.pregroup.draw(diagram, **params)[source]#

Bases:

Draws a pregroup diagram, i.e. of shape word @ ... @ word >> cups.

Parameters:
  • width (float, optional) – Width of the word triangles, default is 2.0.

  • space (float, optional) – Space between word triangles, default is 0.5.

  • textpad (pair of floats, optional) – Padding between text and wires, default is (0.1, 0.2).

  • draw_type_labels (bool, optional) – Whether to draw type labels, default is True.

  • aspect (string, optional) – Aspect ratio, one of ['equal', 'auto'].

  • margins (tuple, optional) – Margins, default is (0.05, 0.05).

  • fontsize (int, optional) – Font size for the words, default is 12.

  • fontsize_types (int, optional) – Font size for the types, default is 12.

  • figsize (tuple, optional) – Figure size.

  • path (str, optional) – Where to save the image, if None we call plt.show().

  • pretty_types (bool, optional) – Whether to draw type labels with superscript, default is False.

  • triangles (bool, optional) – Whether to draw words as triangular states, default is False.

Raises:

ValueError – Whenever the input is not a pregroup diagram.