Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
2 of 29 committers (6.9%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (18.5%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Python interface to Graphviz's Dot language
Basic Info
- Host: GitHub
- Owner: pydot
- Language: Python
- Default Branch: main
- Homepage: https://pypi.python.org/pypi/pydot
- Size: 1.68 MB
Statistics
- Stars: 962
- Watchers: 24
- Forks: 165
- Open Issues: 60
- Releases: 0
Topics
Metadata Files
README.md
Pydot
pydot is a Python interface to Graphviz and its DOT language. You can use pydot to create, read, edit, and visualize graphs.
- It's made in pure Python, with only one dependency – pyparsing – other than Graphviz itself.
- It's compatible with
networkx, which can convert its graphs topydot.
To see what Graphviz is capable of, check the Graphviz Gallery!
Dependencies
- Python: The latest version of pydot supports Python 3.9+. It may work with Python 3.6-3.8, but we can't guarantee full support. If you're using one of these older versions, feel free to experiment, but we won't be able to address issues specific to them. Older versions of pydot are also an option.
pyparsing: used only for loading DOT files, installed automatically duringpydotinstallation.- GraphViz: used to render graphs in a variety of formats, including PNG, SVG, PDF, and more. Should be installed separately, using your system's package manager, something similar (e.g., MacPorts), or from its source.
Installation
- Latest release, from PyPI:
bash
pip install pydot
- Current development code, from this repository:
bash
pip install git+https://github.com/pydot/pydot.git
- Development installation, to modify the code or contribute changes:
```bash # Clone the repository git clone https://github.com/pydot/pydot cd pydot
# (Optional: create a virtual environment) python3 -m venv venv . ./venv/bin/activate
# Make an editable install of pydot from the source tree pip install -e . ```
Quickstart
1. Input
No matter what you want to do with pydot, you'll need some input to start with. Here are the common ways to get some data to work with.
Import a graph from an existing DOT file
Let's say you already have a file example.dot (based on an example from Wikipedia):
dot
graph my_graph {
bgcolor="yellow";
a [label="Foo"];
b [shape=circle];
a -- b -- c [color=blue];
}
You can read the graph from the file in this way:
```python import pydot
graphs = pydot.graphfromdot_file("example.dot") graph = graphs[0] ```
Parse a graph from an existing DOT string
Use this method if you already have a string describing a DOT graph:
```python import pydot
dotstring = """graph mygraph { bgcolor="yellow"; a [label="Foo"]; b [shape=circle]; a -- b -- c [color=blue]; }"""
graphs = pydot.graphfromdotdata(dotstring) graph = graphs[0] ```
Create a graph from scratch using pydot objects
This is where the cool stuff starts. Use this method if you want to build new graphs with Python code.
```python import pydot
graph = pydot.Dot("mygraph", graphtype="graph", bgcolor="yellow")
Add nodes
mynode = pydot.Node("a", label="Foo") graph.addnode(my_node)
Or, without using an intermediate variable:
graph.add_node(pydot.Node("b", shape="circle"))
Add edges
myedge = pydot.Edge("a", "b", color="blue") graph.addedge(my_edge)
Or, without using an intermediate variable:
graph.add_edge(pydot.Edge("b", "c", color="blue")) ```
You can use these basic building blocks in your Python program
to dynamically generate a graph. For example, start with a
basic pydot.Dot graph object, then loop through your data
as you add nodes and edges. Use values from your data as labels to
determine shapes, edges and so on. This allows you to easily create
visualizations of thousands of related objects.
Convert a NetworkX graph to a pydot graph
NetworkX has conversion methods for pydot graphs:
```python import networkx import pydot
See NetworkX documentation on how to build a NetworkX graph.
graph = networkx.drawing.nxpydot.topydot(mynetworkxgraph) ```
2. Edit
You can now further manipulate your graph using pydot methods:
Add more nodes and edges:
python
graph.add_edge(pydot.Edge("b", "d", style="dotted"))
Edit attributes of graphs, nodes and edges:
python
graph.set_bgcolor("lightyellow")
graph.get_node("b")[0].set_shape("box")
3. Output
Here are three different output options:
Generate an image
If you just want to save the image to a file, use one of the write_* methods:
python
graph.write_png("output.png")
If you need to further process the image output, the create_* methods will get you a Python bytes object:
python
output_graphviz_svg = graph.create_svg()
Retrieve the DOT string
There are two different DOT strings you can retrieve:
- The "raw" pydot DOT: This is generated the fastest and will usually still look quite similar to the DOT you put in. It is generated by pydot itself, without calling Graphviz.
python
# As a string:
output_raw_dot = graph.to_string()
# Or, save it as a DOT-file:
graph.write_raw("output_raw.dot")
- The Graphviz DOT: You can use it to check how Graphviz lays out the graph before it produces an image. It is generated by Graphviz.
python
# As a bytes literal:
output_graphviz_dot = graph.create_dot()
# Or, save it as a DOT-file:
graph.write_dot("output_graphviz.dot")
Convert to a NetworkX graph
NetworkX has a conversion method for pydot graphs:
python
my_networkx_graph = networkx.drawing.nx_pydot.from_pydot(graph)
More help
For more help, see the docstrings of the various pydot objects and
methods. For example, help(pydot), help(pydot.Graph) and
help(pydot.Dot.write).
More documentation contributions welcome.
Troubleshooting
Enable logging
pydot uses Python's standard logging module. To see the logs,
assuming logging has not been configured already:
>>> import logging
>>> logging.basicConfig(level=logging.DEBUG)
>>> import pydot
DEBUG:pydot:pydot initializing
DEBUG:pydot:pydot <version>
DEBUG:pydot.core:pydot core module initializing
DEBUG:pydot.dot_parser:pydot dot_parser module initializing
Warning: When DEBUG level logging is enabled, pydot may log the
data that it processes, such as graph contents or DOT strings. This can
cause the log to become very large or contain sensitive information.
Advanced logging configuration
- Check out the Python logging documentation and the
logging_treevisualizer. pydotdoes not add any handlers to its loggers, nor does it setup or modify your root logger. Thepydotloggers are created with the default levelNOTSET.pydotregisters the following loggers:pydot: Parent logger. Emits a few messages during startup.pydot.core: Messages related to pydot objects, Graphviz execution and anything else not covered by the other loggers.pydot.dot_parser: Messages related to the parsing of DOT strings.
License
Distributed under the MIT license.
The module pydot._vendor.tempfile
is based on the Python 3.12 standard library module
tempfile.py,
Copyright © 2001-2023 Python Software Foundation. All rights reserved.
Licensed under the terms of the Python-2.0 license.
Contacts
Current maintainer(s):
- Łukasz Łapiński
Past maintainers:
- Sebastian Kalinowski
Original author: Ero Carrera
Owner
- Name: pydot
- Login: pydot
- Kind: organization
- Repositories: 2
- Profile: https://github.com/pydot
GitHub Events
Total
- Issues event: 29
- Watch event: 43
- Delete event: 18
- Issue comment event: 217
- Push event: 86
- Pull request review event: 70
- Pull request review comment event: 58
- Pull request event: 94
- Fork event: 10
- Create event: 27
Last Year
- Issues event: 29
- Watch event: 43
- Delete event: 18
- Issue comment event: 217
- Push event: 86
- Pull request review event: 70
- Pull request review comment event: 58
- Pull request event: 94
- Fork event: 10
- Create event: 27
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Ioannis Filippidis | j****s@g****m | 125 |
| Peter Nowee | p****r@p****m | 35 |
| Frank Dana | f****c@g****m | 27 |
| Sebastian Kalinowski | s****n@k****u | 23 |
| Łukasz | l****7@g****m | 21 |
| ero.carrera@gmail.com | e****a@g****m@0****7 | 14 |
| dependabot[bot] | 4****] | 11 |
| Lance Hepler | n****r@g****m | 10 |
| Hugo | h****k | 6 |
| Carlos Miguel Jenkins Perez | c****s@h****m | 5 |
| ero.carrera | e****a@0****7 | 4 |
| brlam | t****4@g****m | 2 |
| Julian Jarecki | j****i@g****m | 2 |
| StepSecurity Bot | b****t@s****o | 1 |
| Peter Cock | p****k@g****m | 1 |
| Chris Burr | c****r | 1 |
| Johan-Martijn ten Hove | 4****t | 1 |
| kg | k****6 | 1 |
| leycec | l****c@g****m | 1 |
| Paolo Melchiorre | p****o@m****g | 1 |
| Nigel Bosch | p****b@g****m | 1 |
| Nanno Langstraat | l****h@g****m | 1 |
| Leonard | l****d@s****m | 1 |
| Hrishikesh Terdalkar | h****t@c****n | 1 |
| Gustav Larsson | g****n@g****m | 1 |
| Daniel Chimeno | d****o@t****m | 1 |
| Clinale | 2****4@q****m | 1 |
| Ashafix | m****s@m****l | 1 |
| Alexander Dokuchaev | a****v@i****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 117
- Total pull requests: 314
- Average time to close issues: over 1 year
- Average time to close pull requests: 2 months
- Total issue authors: 80
- Total pull request authors: 26
- Average comments per issue: 3.48
- Average comments per pull request: 2.11
- Merged pull requests: 235
- Bot issues: 0
- Bot pull requests: 74
Past Year
- Issues: 20
- Pull requests: 110
- Average time to close issues: 7 days
- Average time to close pull requests: 6 days
- Issue authors: 12
- Pull request authors: 7
- Average comments per issue: 2.65
- Average comments per pull request: 2.49
- Merged pull requests: 69
- Bot issues: 0
- Bot pull requests: 35
Top Authors
Issue Authors
- ferdnyc (14)
- GoogleCodeExporter (8)
- peternowee (5)
- johnyf (4)
- 2br-2b (4)
- sandrotosi (3)
- lkk7 (3)
- cheikhnadiouf (2)
- wildoranges (2)
- StevanWhite (2)
- Veek (1)
- goerz (1)
- thomasvengal (1)
- iamaziz (1)
- Lucas-C (1)
Pull Request Authors
- ferdnyc (147)
- dependabot[bot] (74)
- lkk7 (40)
- peternowee (17)
- tusharsadhwani (5)
- juusomer (4)
- SagaraBattousai (2)
- step-security-bot (2)
- henrywu2019 (2)
- johnyf (2)
- AlexanderDokuchaev (2)
- davidweichiang (2)
- chrizzFTD (2)
- qinyeli (1)
- mathstuf (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 20
-
Total downloads:
- pypi 13,258,891 last-month
- Total docker downloads: 169,633,707
-
Total dependent packages: 402
(may contain duplicates) -
Total dependent repositories: 11,346
(may contain duplicates) - Total versions: 78
- Total maintainers: 4
pypi.org: pydot
Python interface to Graphviz's Dot
- Homepage: https://github.com/pydot/pydot
- Documentation: https://pydot.readthedocs.io/
-
Latest release: 4.0.1
published 8 months ago
Rankings
Maintainers (3)
alpine-v3.18: py3-pydot-pyc
Precompiled Python bytecode for py3-pydot
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 1.4.2-r3
published almost 3 years ago
Rankings
Maintainers (1)
alpine-v3.18: py3-pydot
Python interface to Graphviz's Dot language
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 1.4.2-r3
published almost 3 years ago
Rankings
Maintainers (1)
alpine-v3.13: py3-pydot
Python interface to Graphviz's Dot language
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 1.4.1-r2
published over 5 years ago
Rankings
Maintainers (1)
proxy.golang.org: github.com/pydot/pydot
- Documentation: https://pkg.go.dev/github.com/pydot/pydot#section-documentation
-
Latest release: v4.0.1+incompatible
published 8 months ago
Rankings
alpine-v3.14: py3-pydot
Python interface to Graphviz's Dot language
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 1.4.1-r3
published almost 5 years ago
Rankings
Maintainers (1)
alpine-edge: py3-pydot-pyc
Precompiled Python bytecode for py3-pydot
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 3.0.2-r0
published about 1 year ago
Rankings
Maintainers (1)
alpine-edge: py3-pydot
Python interface to Graphviz's Dot language
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 3.0.2-r0
published about 1 year ago
Rankings
Maintainers (1)
alpine-v3.15: py3-pydot
Python interface to Graphviz's Dot language
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 1.4.2-r0
published over 4 years ago
Rankings
Maintainers (1)
alpine-v3.16: py3-pydot
Python interface to Graphviz's Dot language
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 1.4.2-r1
published about 4 years ago
Rankings
Maintainers (1)
alpine-v3.17: py3-pydot
Python interface to Graphviz's Dot language
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 1.4.2-r1
published about 4 years ago
Rankings
Maintainers (1)
anaconda.org: pydot
This module provides with a full interface to create handle modify and process graphs in Graphviz’s dot language.
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 3.0.4
published about 1 year ago
Rankings
alpine-v3.19: py3-pydot-pyc
Precompiled Python bytecode for py3-pydot
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 1.4.2-r3
published almost 3 years ago
Rankings
Maintainers (1)
alpine-v3.22: py3-pydot
Python interface to Graphviz's Dot language
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 3.0.2-r0
published about 1 year ago
Rankings
Maintainers (1)
alpine-v3.20: py3-pydot-pyc
Precompiled Python bytecode for py3-pydot
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 1.4.2-r4
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.22: py3-pydot-pyc
Precompiled Python bytecode for py3-pydot
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 3.0.2-r0
published about 1 year ago
Rankings
Maintainers (1)
alpine-v3.21: py3-pydot-pyc
Precompiled Python bytecode for py3-pydot
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 3.0.2-r0
published about 1 year ago
Rankings
Maintainers (1)
alpine-v3.19: py3-pydot
Python interface to Graphviz's Dot language
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 1.4.2-r3
published almost 3 years ago
Rankings
alpine-v3.20: py3-pydot
Python interface to Graphviz's Dot language
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 1.4.2-r4
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.21: py3-pydot
Python interface to Graphviz's Dot language
- Homepage: https://github.com/pydot/pydot
- License: MIT
-
Latest release: 3.0.2-r0
published about 1 year ago
Rankings
Maintainers (1)
Dependencies
- chardet *
- graphviz >=2.38.0
- pyparsing >=2.0.1
- chardet *
- pyparsing >=2.1.4