1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
Formats
-------
To use a different `output file format <DOT outputs_>`_ than the default PDF,
you can use the ``format`` argument when creating your :class:`.Graph`
or :class:`.Digraph` object:
.. doctest::
>>> import graphviz
>>> g = graphviz.Graph(format='png') # doctest: +NO_EXE
You can also change the :attr:`~.Graph.format` attribute on an existing graph
object:
.. doctest::
>>> doctest_mark_exe() # skip this line
>>> dot = graphviz.Digraph('hello')
>>> dot.edge('hello', 'world')
>>> dot.format = 'svg'
>>> dot.render(directory='doctest-output').replace('\\', '/')
'doctest-output/hello.gv.svg'
.. include:: _links.rst
|