I want to change the color and size of the text above the edges of a graph.
According to the docs, labelfontsize
and labelfontcolor
should do it for taillabel
and headlabel
(and indeed they do).
How do I do it if I want to place my label on the center of the edge using label
?
Here's an example of "something red" showing in black and fontsize=20
. If you change label
for headlabel
, arguments work as expected.
DiagrammeR::grViz("
digraph boxes_and_circles {
# a 'graph' statement
graph [overlap = true, fontsize = 20, rankdir='LR']
# several 'node' statements
node [shape = circle,
fixedsize = true,
width=0.9,
fontname = Helvetica]
A; B
A -> B [label='something red', labelfontsize=2, labelfontcolor=red]
}
")
CodePudding user response:
If I understand you correctly:
DiagrammeR::grViz("
digraph boxes_and_circles {
# a 'graph' statement
graph [overlap = true, fontsize = 20, rankdir='LR']
# several 'node' statements
node [shape = circle,
fixedsize = true,
width=0.9,
fontname = Helvetica]
A; B
A -> B [label='something red', fontsize=15, fontcolor='#ff0000']
}
")
https://cran.microsoft.com/snapshot/2015-03-28/web/packages/DiagrammeR/README.html