I wish to add labels to my nodes, a main label with font size X and a sublabel with font size X * 0.5. My sublabel needs to have number formatting where 87650 is displayed as 87,650.
Is this possible in DiagrammeR?
My numerical sublabel data comes from a data frame.
library(DiagrammeR)
grViz("
digraph test {
graph []
node [shape = box]
A [label = '@@1']
B [label = 'BarFoo']
A -> B
}
[1]: paste0('Main Heading \\n', sum(iris$Sepal.Length)*100)
")
I'd use format() to process the number first, and then call the result later.
Please run the example code below:
library(DiagrammeR)
mysum <- sum(iris$Sepal.Length)*100
input <- format(mysum, big.mark = ",")
grViz("
digraph test {
graph []
node [shape = box]
A [label = '@@1']
B [label = 'BarFoo']
A -> B
}
[1]: paste0('Main Heading \\n', input)
")