Comments (1)
Thanks, glad if it is somewhat useful.
Not completely sure this is about the right thing though, as the .render()
-method has no path
argument:
>>> from graphviz import Graph
>>> g = Graph(format="svg")
>>> g.node('spam')
>>> g.render(path='spam')
Traceback (most recent call last):
File "<pyshell#12>", line 1, in <module>
g.render(path='spam')
TypeError: render() got an unexpected keyword argument 'path'
The method does have filename
and directory
arguments. However, the former is for the name of the source (DOT, text) file. The actual rendering then does dot -Tsvg -O Graph.gv
which automatically appends the right file extension to the name (in this case, the rendered file would be Graph.gv.svg
):
-O - Automatically generate an output filename based on the input file
name with a .'format' appended. (Causes all -ofile options to be ignored.)
In other words, this follows the idea from the Graphviz commands to specify the format to infer the file extension from instead of the other way around (which AFAIU is what you want to propose, right?).
Note that this is why the .render()
-method returns the path to the rendered file.
Note that by default filename
is inferred from name
, so maybe you want to try:
>>> import graphviz
>>> g = graphviz.Graph('fig1', directory='figures', format='svg')
>>> g.node('spam')
>>> g.render()
'figures/fig1.gv.svg'
from graphviz.
Related Issues (20)
- Make graphviz work in Jupyterlite HOT 1
- multiple incoming edges HOT 2
- Adapt for sphinx-gallery: add `_repr_html_` HOT 4
- memory issue HOT 1
- Add type annotations
- Any example of samehead or sametail would help HOT 2
- NameError: name 'doctest_mark_exe' is not defined HOT 2
- graphiviz-0.20.1 failed tests/test_quoting.py with python 3.12 HOT 2
- Docs: typo 'raise_if_result_exits' in render() argument name HOT 1
- Black colored decision box alongside root node is visible on MAC M1 on installation of graphviz HOT 2
- [self-tests] `test_render_unknown_parameter_raises` fails HOT 5
- Edge labels overlap with edges HOT 3
- New version?🤔 HOT 8
- Fix call-signature related own `PendingDeprecationWarning` in tests HOT 6
- pytest 8.1.1: import file mismatch HOT 2
- Add support of `-Goverlap=scale` flag HOT 4
- Non-unique module names cause test failures with pytest HOT 2
- import error HOT 1
- Doesn't print the vertical bar if uses f-string HOT 2
- Plots cut off in Jupyter Notebook HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphviz.