Convert a digraph in dot format to SVG and save it to a range of output file types

save_dot(
  dot,
  filename,
  size = std_size$half,
  maxWidth = size$width,
  maxHeight = size$height,
  formats = c("dot", "png", "pdf", "svg"),
  landscape = size$rot != 0,
  ...
)

Arguments

dot

a graphviz dot string

filename

the full path of the file name (minus extension for multiple formats)

size

a named list with 3 elements, length and width in inches and rotation. A predefined set of standard sizes are available in the std_size object.

maxWidth

a width (on the paper) in inches if size is not defined

maxHeight

a height (on the paper) in inches if size is not defined

formats

some of pdf,dot,svg,png,ps

landscape

rotate the output by 270 degrees into a landscape format. maxWidth and maxHeight still apply and refer to the paper width to fit the flowchart into after rotation. (you might need to flip width and height)

...

ignored

Value

a list with items paths with the absolute paths of the saved files as a named list, and svg as the SVG string of the rendered dot file.

Examples

save_dot("digraph {A->B}",tempfile())
#> $paths
#> $paths$dot
#> [1] "/tmp/RtmpY4zbif/file1740239ee96eb.dot"
#> 
#> $paths$png
#> [1] "/tmp/RtmpY4zbif/file1740239ee96eb.png"
#> 
#> $paths$pdf
#> [1] "/tmp/RtmpY4zbif/file1740239ee96eb.pdf"
#> 
#> $paths$svg
#> [1] "/tmp/RtmpY4zbif/file1740239ee96eb.svg"
#> 
#> 
#> $svg
#> [1] "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: %0 Pages: 1 -->\n<svg width=\"62.000pt\" height=\"116.000pt\"\n viewBox=\"0 0 62.000 116.000\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1.000 1.000) rotate(0) translate(4 112.000)\">\n<title>%0</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-112 58,-112 58,4 -4,4\"/>\n<!-- A -->\n<g id=\"node1\" class=\"node\">\n<title>A</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"27\" cy=\"-90\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"27\" y=\"-85.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">A</text>\n</g>\n<!-- B -->\n<g id=\"node2\" class=\"node\">\n<title>B</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"27\" cy=\"-18\" rx=\"27\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"27\" y=\"-13.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">B</text>\n</g>\n<!-- A&#45;&gt;B -->\n<g id=\"edge1\" class=\"edge\">\n<title>A&#45;&gt;B</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M27,-71.8314C27,-64.131 27,-54.9743 27,-46.4166\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"30.5001,-46.4132 27,-36.4133 23.5001,-46.4133 30.5001,-46.4132\"/>\n</g>\n</g>\n</svg>\n"
#>