christophergandrud / christophergandrud/networkD3

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

Open
#252 11 comments 0 reactions 0 assignees View on GitHub
bug sankeyNetwork
Dominant language
R
Stars
659
Forks
259
PR merge metrics
No merged PRs in 30d

Description

Sankey networks have been super useful in [`drake`](https://github.com/ropensci/drake). However, I am noticing rendering problems when the network is super large: https://github.com/ropensci/drake/issues/836.

``` r
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"
)
```

![](https://i.imgur.com/YcGvmEH.png)

Created on 2019-04-16 by the [reprex package](https://reprex.tidyverse.org) (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.

``` r
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"
)
```

![](https://i.imgur.com/5AtXk9V.png)

Created on 2019-04-16 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.