Xinxin Yang's avatar
Xinxin Yang committed
product_list %>% filter(code == "SUNO")


plotList <- function(nplots) {
  lapply(seq_len(nplots), function(x) plot_ly())
}
fig <- subplot(p1, p2)

nodes1 = nodes_position(biofuels_ln_baseline[[2]])
links1 = biofuels_ln_baseline[[1]]

links2 <- biofuels_ln[[1]]
nodes2 <- nodes_position(biofuels_ln[[2]])

fig <- plot_ly(
  width = 1000,
  height = 800,
  type = "sankey",
  # domain = list(
  #   x =  c(0,1),
  #   y =  c(0,1)
  # ),
  orientation = "h",
  arrangement = 'snap',
  valueformat = ".0f",
  valuesuffix = " tonnes",

  node = list(
    label = nodes$label,
    color = nodes$color,
    x = nodes$level_x,
    y= nodes$level_y,
    pad = 20,
    thickness = 15,
    line = list(
      color = "blau",
      width = 1
    )
  ),

  link = list(
    source = links$source,
    target = links$target,
    value =  links$value,
    color = links$color
    #label =  links$group
  )
)  %>% layout(
  autosize = F,
  margin = list(l=10, r=10, b=50, t=50, pad=40),
  title = "Market Balance in Tonnens",
  font = list(size = 13, family ="Arial"),
  xaxis = list(showgrid = F, zeroline = F),
  yaxis = list(showgrid = F, zeroline = F)
)