mbojan / alluvial

Alluvial diagrams
Other
139 stars 26 forks source link

Option for bypassing some ribbons? #33

Closed adeldaoud closed 7 years ago

adeldaoud commented 7 years ago

Hi

Thanks for a great package, first of all.

I wonder if it is possible for some ribbons to “by-pass” some categories along the way (from left to right)? For example, the networkD3 package has this functionality (https://christophergandrud.github.io/networkD3/), see specifically the sankeyNetwork example with the Energy example (code copied into here).

library(networkD3)
# Load energy projection data
URL <- paste0(
        "https://cdn.rawgit.com/christophergandrud/networkD3/",
        "master/JSONdata/energy.json")
Energy <- jsonlite::fromJSON(URL)
# Plot
sankeyNetwork(Links = Energy$links, Nodes = Energy$nodes, Source = "source",
             Target = "target", Value = "value", NodeID = "name",
             units = "TWh", fontSize = 12, nodeWidth = 30)

Notice, for instance, how the “Oil import” category flows via the “Oil” category, but by-passes the “Thermal generation” category. Is this possible to achieve with the alluvial package?

mbojan commented 7 years ago

Hi, thanks.

The short answer is no, you can't do that with alluvial. The short answer to "why?" is

If "networkD3" does not fill your bill you may try "riverplot" from https://logfc.wordpress.com/2014/02/27/riverplot/