plot.dagitty assumes nodes are labelled with text, but R graphics supports using expressions for labels with the plotmath scheme. This adds a parameter to plot.dagitty called nodenames, that allows some or all of the nodes to be renamed. For example, this code
library(dagitty)
g = dagitty('dag{
A [pos="-1,0.5"]
W [pos="0.893,-0.422"]
X [pos="0,-0.5"]
Y [pos="1,0.5"]
A -> Y
X -> A
X -> W
X -> Y
}')
plot(g, nodenames = expression(X = alpha^2))
plots the graph with node X labeled using alpha^2.
Thanks, and sorry for seeing this so late! I just made s slight change, the parameter is now called "node.names" so it's more consistent with the others.
plot.dagitty
assumes nodes are labelled with text, but R graphics supports using expressions for labels with the plotmath scheme. This adds a parameter toplot.dagitty
callednodenames
, that allows some or all of the nodes to be renamed. For example, this codeplots the graph with node
X
labeled usingalpha^2
.