Search code examples
rdiagrammer

DiagrammeR fontsize argument does nothing


I can change the fontsize argument below to be either graph [fontsize = 1] or graph [fontsize = 10] or graph [fontsize = 100] and the output in my R Studio viewer is identical. It appears the font defaults to a reasonable size that fills the node it occupies. How do I change the font size?

library(DiagrammeR)

grViz("
  digraph test {
    graph [fontsize = 10]

    node [shape = box]
    A [label = 'FooBar']
    B [label = 'BarFoo']

    A -> B
  }
")

Solution

  • You change the font size of the node labels within the node declaration.

    You can change it using node: node [shape = box, fontsize=5] or in a specific node label with: A [label = 'FooBar', fontsize=5]