1

The newline \n 'line break' doesn't seem to work with the networkD3 package. Or maybe I'm not applying \n properly. How do I line break on line #2 shown below when using the diagonalNetwork() function?

library(networkD3)
nd3 <- list(name = "Start\nSecond Line",  # line 2
            children = list(list(name = "A", 
                                 children = list(list(name = "*1"), 
                                                 list(name = "2"), 
                                                 list(name = "3"))), 
                            list(name = "B")))
diagonalNetwork(List = nd3, fontSize = 18, opacity = 0.9)

enter image description here

Display name
  • 4,153
  • 5
  • 27
  • 75
  • 1
    see https://stackoverflow.com/questions/44700596/put-line-break-in-node-labels-in-networkd3-sankey-diagram – CJ Yetman Feb 20 '19 at 19:56
  • 1
    though it depends on whether you’re talking about `sankeyNetwork` or `diagonalNetwork`... pretty sure it works with Sankey but not the others – CJ Yetman Feb 20 '19 at 19:58
  • You're right. I edited my question to get rid of 'Sankey'. Got confused in my terminology. I'm curious how to do this with the `diagonalNetwork()` function. – Display name Feb 20 '19 at 20:17
  • 1
    Then the link above is relevant... the conversation there occurred before that feature was added to `sankeyNetwork`... it was never added to the other `networkD3` functions – CJ Yetman Feb 20 '19 at 21:21

0 Answers0