prov.dot

prov.dot renders a ProvDocument as a pydot Dot graph, which a local Graphviz install writes out as PNG, SVG or PDF. prov.dot needs the dot extra. Render a document as a graph (PNG, SVG, PDF) covers the Graphviz setup and worked examples, and its “Draw one bundle” section covers a bundle that is not a document.

prov.dot.prov_to_dot(bundle: ProvBundle, show_nary: bool = True, use_labels: bool = False, direction: str = 'BT', show_element_attributes: bool = True, show_relation_attributes: bool = True) → Dot[source]

Convert a provenance document into a DOT graphical representation.

A bundle that is not a document warns DeprecationWarning and is drawn as a document would be, and 4.0 draws documents only. The graphics how-to guide, in its section on drawing one bundle, shows the replacement.

The document is first unified(); if that raises ProvException (the document cannot be unified), the original, non-unified document is rendered instead.

Parameters:
  • bundle – The provenance document to be converted.

  • show_nary – Show all elements of n-ary relations (i.e. relations with more than two formal attributes), not just the first two.

  • use_labels – Use the prov:label property of an element as its displayed name (instead of its identifier), where available.

  • direction – Direction of the graph, passed to Graphviz as rankdir. Valid values are "BT" (default), "TB", "LR", "RL"; any other value is silently replaced with "BT".

  • show_element_attributes – Show attributes of elements as annotation nodes.

  • show_relation_attributes – Show attributes of relations as annotation nodes.

Returns:

The pydot.Dot graph object.