How to create Sankey Diagram in JULIA ? Is there any working package completely in Julia ? JuliaHub this is not working properly .
~ julia ✔
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.8.3 (2022-11-14)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
(@v1.8) pkg> add Plots
Updating registry at `~/.julia/registries/General.toml`
Resolving package versions...
No Changes to `~/.julia/environments/v1.8/Project.toml`
No Changes to `~/.julia/environments/v1.8/Manifest.toml`
julia> using SankeyPlots
julia> src = [1, 1, 1, 1, 2, 2, 2, 3, 4, 5]
10-element Vector{Int64}:
1
1
1
1
2
2
2
3
4
5
julia> dst = [6, 3, 7, 4, 3, 7, 4, 7, 8, 8]
10-element Vector{Int64}:
6
3
7
4
3
7
4
7
8
8
julia> weights = [0.1, 0.3, 0.5, 0.5, 0.2, 2.8, 1, 0.45, 4.5, 3.3]
10-element Vector{Float64}:
0.1
0.3
0.5
0.5
0.2
2.8
1.0
0.45
4.5
3.3
julia> sankey(src, dst, weights)
julia> names = [
"PV",
"Electricity Buy",
"Battery",
"Heat pump",
"Biomass",
"Electricity Sell",
"Electricity Demand",
"Heat demand",
]
8-element Vector{String}:
"PV"
"Electricity Buy"
"Battery"
"Heat pump"
"Biomass"
"Electricity Sell"
"Electricity Demand"
"Heat demand"
julia> energy_colors = palette(:seaborn_colorblind)[[9, 10, 3, 5, 2, 8, 1, 4]]
ERROR: UndefVarError: palette not defined
Stacktrace:
[1] top-level scope
@ REPL[8]:1
julia> sankey(
src, dst, weights;
node_labels=names,
node_colors=energy_colors,
edge_color=:gradient,
label_position=:bottom,
label_size=7,
compact=true,
force_layer=[6=>2],
force_order=[5=>1]
)
ERROR: UndefVarError: energy_colors not defined
Stacktrace:
[1] top-level scope
@ REPL[9]:1
julia>