I am writing a visualisation with graphviz in python. I imported graphviz and pylab. I figured out how to save the graphic representation
import graphviz as gv
import pylab
g1 = gv.Graph(format='png')
g1.node('A')
g1.node('B')
g1.edge('A', 'B')
g1.view()
print(g1.source)
filename = g1.render(filename='img/g1')
pylab.savefig('filename.png')
How can i save the source to a .dot file?
How do I use graphviz to convert this into an image? For windows: dl the msi and install; Find gvedit.exe in your programs list; Open . dot file in question; Click running person on toolbar; Go to graph -> settings ; change Output file type to file type of your liking and press ok..
When you used g1.render(filename='img/g1')
, it dumped the source to img/g1
.
Just open it with a text editor.
If you want to name it, used g1.render(filename='g1.dot')
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With