Skip to content

sankey network with too many nodes to display horizontally makes layout go crazy #252

@wlandau

Description

@wlandau

Sankey networks have been super useful in drake. However, I am noticing rendering problems when the network is super large: ropensci/drake#836.

library(networkD3)
library(tidyverse)
n <- 50
nodes <- data.frame(
  id = seq(0L, n)
)
edges <- data.frame(
  from = rep(0L, n),
  to = seq_len(n),
  value = 1L
)
sankeyNetwork(
  Links = edges,
  Nodes = nodes,
  Source = "from",
  Target = "to",
  Value = "value"
)

Created on 2019-04-16 by the reprex package (v0.2.1)

Is there a way to improve how the edges render on the left? The desired result is similar to the graph below.

library(networkD3)
library(tidyverse)
n <- 10
nodes <- data.frame(
  id = seq(0L, n)
)
edges <- data.frame(
  from = rep(0L, n),
  to = seq_len(n),
  value = 1L
)
sankeyNetwork(
  Links = edges,
  Nodes = nodes,
  Source = "from",
  Target = "to",
  Value = "value"
)

Created on 2019-04-16 by the reprex package (v0.2.1)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions