Percentage size for SVG output

Is there any way to specify the size of the output as a percentage? For a graph I created without specifying any size, dot generated an SVG file containing the following:

<svg width="1389pt" height="382pt"
viewBox="0.00 0.00 1389.00 382.09" xmlns="" xmlns:xlink="">

If I edit the SVG file after Graphviz/dot has created it and change this to:

<svg width="100%" height="100%"
viewBox="0.00 0.00 1389.00 382.09" xmlns="" xmlns:xlink="">

then the entire diagram automatically and dynamically scales itself to whatever size I make my browser window when viewing the SVG diagram. However, this edit is of course obliterated every time I invoke dot to regenerate the SVG file from the Graphviz input file.

If I use the size parameter in the Graphviz input file I still get the fixed point size output in the SVG. This is sort of understandable since the attribute reference lists the type for the size parameter as "double point", but I'm wondering if there's any way to set the width and height as percentages other than editing the SVG output directly after Graphviz/dot creates it.

graph Network {

I'm calling Graphviz from a

I'm calling Graphviz from a Perl script so no need for sed. I was just trying to reduce the amount of postprocessing as much as possible. I'm doing postprocessing anyway for other things so it's not a big deal that I have to change the size as well. Thanks.

Not at present. As a

Not at present. As a workaround, you can at least use a script containing something like

dot -Tsvg a.gv | sed -E 's/<svg width="[0-9]+pt" height="[0-9]+pt"/<svg width="100%" height="100%"/' > a.svg

to automate the change.

Recent comments