Open matthijsvk opened 1 year ago
Sorry for the late reply, What you could is to turn off save graph option and then save it in svg format manually. Since this could be done with just one line of code, I am not really willing to put it. But if you or someone else provide nice PR, I would accept it.
@matthijsvk You can save the graph as SVG (or any other format supported by graphviz
) like this:
graph = draw_graph(model, ...).visual_graph
graph_svg = graph.pipe(format='svg').decode('utf-8') # convert to binary data
with open(save_path + '.' + format, 'wb') as f:
f.write(graph_svg)
How can I save as png?
s, u can @naik-amey. just set format arg to "png"
Is your feature request related to a problem? Please describe. If saving to disk, the default output format is PNG which is inefficient and low-resolution. I couldn't find a way to save as SVG instead, though I'm sure graphviz supports this.
Describe the solution you'd like add option "format=[svg|png]" that allows choosing the file format. Alternatively, derive it from the filename, i.e. filename="model.svg" sets format=svg automatically.
Describe alternatives you've considered This works:
but this first saves a PNG and then the SVG as well, it would be cleaner if we had an option in the draw_graph() function itself