File: formats.rst

package info (click to toggle)
python-graphviz 0.20.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,188 kB
  • sloc: python: 4,098; makefile: 13
file content (30 lines) | stat: -rw-r--r-- 704 bytes parent folder | download
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