Skip to main content

Latest PyPI Version License Supported Python Versions Format Readthedocs

Travis Codecov

This package facilitates the creation and rendering of graph descriptions in the DOT language of the Graphviz graph drawing software (master repo) from Python.

Create a graph object, assemble the graph by adding nodes and edges, and retrieve its DOT source code string. Save the source code to a file and render it with the Graphviz installation of your system.

Use the view option/method to directly inspect the resulting (PDF, PNG, SVG, etc.) file with its default application. Graphs can also be rendered and displayed within Jupyter notebooks (formerly known as IPython notebooks, example) as well as the Jupyter Qt Console.

Installation

This package runs under Python 2.7, and 3.5+, use pip to install:

$ pip install graphviz

To render the generated DOT source code, you also need to install Graphviz (download page).

Make sure that the directory containing the dot executable is on your systems’ path.

Quickstart

Create a graph object:

>>> from graphviz import Digraph

>>> dot = Digraph(comment='The Round Table')

>>> dot  #doctest: +ELLIPSIS
<graphviz.dot.Digraph object at 0x...>

Add nodes and edges:

>>> dot.node('A', 'King Arthur')
>>> dot.node('B', 'Sir Bedevere the Wise')
>>> dot.node('L', 'Sir Lancelot the Brave')

>>> dot.edges(['AB', 'AL'])
>>> dot.edge('B', 'L', constraint='false')

Check the generated source code:

>>> print(dot.source)  # doctest: +NORMALIZE_WHITESPACE
// The Round Table
digraph {
    A [label="King Arthur"]
    B [label="Sir Bedevere the Wise"]
    L [label="Sir Lancelot the Brave"]
    A -> B
    A -> L
    B -> L [constraint=false]
}

Save and render the source code, optionally view the result:

>>> dot.render('test-output/round-table.gv', view=True)  # doctest: +SKIP
'test-output/round-table.gv.pdf'
https://raw.github.com/xflr6/graphviz/master/docs/round-table.png

See also

License

This package is distributed under the MIT license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphviz-0.13.2.zip (181.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphviz-0.13.2-py2.py3-none-any.whl (17.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file graphviz-0.13.2.zip.

File metadata

  • Download URL: graphviz-0.13.2.zip
  • Upload date:
  • Size: 181.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/2.7.16

File hashes

Hashes for graphviz-0.13.2.zip
Algorithm Hash digest
SHA256 60acbeee346e8c14555821eab57dbf68a169e6c10bce40e83c1bf44f63a62a01
MD5 922b5a3663250063eac0f4737dcbc17b
BLAKE2b-256 5d71f63fe59145fca7667d92475f1574dd583ad1f48ab228e9a5dddd5733197f

See more details on using hashes here.

File details

Details for the file graphviz-0.13.2-py2.py3-none-any.whl.

File metadata

  • Download URL: graphviz-0.13.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/2.7.16

File hashes

Hashes for graphviz-0.13.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 241fb099e32b8e8c2acca747211c8237e40c0b89f24b1622860075d59f4c4b25
MD5 dcea63f168289796aa3ab892da95a87a
BLAKE2b-256 f574dbed754c0abd63768d3a7a7b472da35b08ac442cf87d73d5850a6f32391e

See more details on using hashes here.

Release history Release notifications | RSS feed

0.21

2 files

0.20.3

2 files

0.20.2

2 files

0.20.1

2 files

0.20

2 files

0.19.2

2 files

0.19.1

2 files

0.19

2 files

0.18.2

2 files

0.18.1

2 files

0.18

2 files

0.17

2 files

0.16

2 files

0.15

2 files

0.14.2

2 files

0.14.1

2 files

0.14

2 files

This release

0.13.2 This release

2 files

0.13.1

2 files

0.13

2 files

0.12

2 files

0.11.1

2 files

0.11

2 files

0.10.1

2 files

0.10

2 files

0.9

2 files

0.8.4

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.8

2 files

0.7.1

2 files

0.7

2 files

0.6

2 files

0.5.2

2 files

0.5.1

2 files

0.5

2 files

0.4.10

2 files

0.4.9

2 files

0.4.8

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

1 file

0.3.1

1 file

0.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2

1 file

0.1.1

1 file

0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page