export_as_svg {causalHyperGraph} | R Documentation |
Export causal hypergraphs in svg format
Description
export_as_svg()
exports the hypergraphs to svg files for editing with svg software.
Usage
export_as_svg(x, file, sep = "", verbose = TRUE)
Arguments
x |
A graph generated with |
file |
Character vector specifying file names for the graphs in |
sep |
Separator passed to |
verbose |
Logical; if |
Details
Although causalHyperGraph()
optimizes the placement of the nodes and edges
(using DiagrammeR) as much as possible,
the resulting graph may still need manual adjustments to enhance its readability.
In case of multi-value graphs, for example, factor values may be packed too closely or even printed
on top of each other, calling for manual disentangling. Once the graphs have been exported via
export_as_svg()
such adjustments can be made with any svg software, such as Inkscape, Adobe Illustrator,
or Apache Batik. Moreover, svg files can easily be converted to pdf or other formats.
Value
Returns the names of the generated file(s) invisibly.
See Also
causalHyperGraph
, and the methods plot.cna
.
Examples
library(cna) # required for randomCsf() and allCombs()
# Manual crisp-set example.
x <- "(X+Y<->S)*(D+s*B<->E)*(A+S*B<->C)*(C+E<->F)"
gr1 <- causalHyperGraph(x)
export_as_svg(gr1, file.path(tempdir(), "csGraph"))
# Random multi-value example.
y <- randomCsf(allCombs(c(3,4,3,5,3,4)))
gr2 <- chg(y)
export_as_svg(gr2, file.path(tempdir(), "mvGraph"))
file.remove(file.path(tempdir(), c("csGraph.svg", "mvGraph.svg")))