Multi-line node labels in a network graph?

Hello,

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, much like what can be accomplished in a mouseover tooltip, but in this case the text should be displayed all the time. My use case is to show how servers relate to each other while displaying basic information about each server. Ideally I would style the labels using HTML/CSS.

I've looked at the visNetwork and diagrammeR packages but I only see how to do a single line node label.

I want my nodes to display information like:

System 1
Location: Server Room 1
Description: RShiny Server
Users: Analytics Group

Server 2
Location: Server Room 2
Description: Mail Server
Users: All Staff

Is r2d3 another possibility? Pointers to an online example (with code) or other example code would be very helpful.

Cheers!
Tim

Well, the kludge is to identify your nodes simply, and then overplot using ggrep, ggplot and similar tools, inserting a newline.

The next kludge is to label the notes in Illustrator, which will give you full control over line breaks, typography and color. Depends on how often you do this.

hbrthemes has a lot of options, but it's not full css. Solutions similar to the SO are probably going to end up as time consuming as handwork in Illustrator.

Your solution depends on the number of nodes and how often they change.

There will be a large number of nodes, and the idea is to use a data-driven approach for updates rather than the current manual process using PowerPoint. I would also like to have multiple versions of the chart where displayed details change based on the audience.
Perhaps an organization chart in diagrammeR could be adapted to this purpose? I will continue to look further. System1System2

I've made some good progress with DiagrammeR, as noted in my post on StackOverflow, here: https://stackoverflow.com/questions/56686350/r-network-graph-with-mult-line-labels

Code:

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];")

However, it does not seem possible to change font sizes within the label, only the size of node labels overall.
System1System2DiagrammeR

The answer: Use <br>, <b>, <small> in DiagrammeR:

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>];")

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.