Search code examples
rdiagrammervisnetwork

Network graph with mult-line labels?


I am trying to create a network graph of nodes with labels that contain multiple lines. The lines should have different font size and style to convey information about that node. The details must be displayed at all times, not using a mouse-over tool-tip (See attached diagram). The goal is to replace a large, labor-intensive PowerPoint slide with something data-driven because the nodes and information change over time. There are many nodes, and the details displayed may change depending on the audience.

enter image description here

In DiagrammeR it is possible to split the label onto multiples lines using <br> and format using <center> and <b>. You can also set the font size for the entire node label, but I do not see where it is possible to change font sizes within and individual label.

Cheers

UPDATE: This gets me close to what I am looking for but I can't see how to use multiple font sizes within a single label.

library("DiagrammeR")
DiagrammeR("graph LR;
           A[<center><b>System 1</b></center><br><b>Location</b>: US<br><b>Description:</b> RShiny Server<br><b>Users:</b> AnalyticsGroup] -- files from-->B;
           B[<center><b>System 2</b></center><br><b>Location</b>: UK<br><b>Description:</b> File Server<br><b>Users:</b> All Company];")

enter image description here


Solution

  • The answer using DiagrammeR with tags <br>, <br> and <small>

    library("DiagrammeR")
    DiagrammeR("graph LR;
                   A[<center><b>System 1</b></center><br><small><b>Location</b>: US<br><b>Description:</b> RShiny Server<br><b>Users:</b> AnalyticsGroup</small>] -- files from-->B;
                   B[<center><b>System 2</b></center><br><small><b>Location</b>: UK<br><b>Description:</b> File Server<br><b>Users:</b> All Company</small>];")
    

    enter image description here