Exception in Sankey Diagram in Pluto

I am getting this exception in Pluto while using SankeyPlots.
Although i am getting correct sankey plot.

Failed to guesstimate plot size

exception

MethodError: no method matching length(::Nothing)

Closest candidates are:

length(!Matched::Union{Base.KeySet, Base.ValueIterator}) at abstractdict.jl:58

length(!Matched::Union{LinearAlgebra.Adjoint{T, <:Union{StaticArraysCore.StaticArray{Tuple{var"#s2"}, T, 1} where var"#s2", StaticArraysCore.StaticArray{Tuple{var"#s3", var"#s4"}, T, 2} where {var"#s3", var"#s4"}}}, LinearAlgebra.Diagonal{T, <:StaticArraysCore.StaticArray{Tuple{var"#s13"}, T, 1} where var"#s13"}, LinearAlgebra.Hermitian{T, <:StaticArraysCore.StaticArray{Tuple{var"#s10", var"#s11"}, T, 2} where {var"#s10", var"#s11"}}, LinearAlgebra.LowerTriangular{T, <:StaticArraysCore.StaticArray{Tuple{var"#s18", var"#s19"}, T, 2} where {var"#s18", var"#s19"}}, LinearAlgebra.Symmetric{T, <:StaticArraysCore.StaticArray{Tuple{var"#s7", var"#s8"}, T, 2} where {var"#s7", var"#s8"}}, LinearAlgebra.Transpose{T, <:Union{StaticArraysCore.StaticArray{Tuple{var"#s2"}, T, 1} where var"#s2", StaticArraysCore.StaticArray{Tuple{var"#s3", var"#s4"}, T, 2} where {var"#s3", var"#s4"}}}, LinearAlgebra.UnitLowerTriangular{T, <:StaticArraysCore.StaticArray{Tuple{var"#s24", var"#s25"}, T, 2} where {var"#s24", var"#s25"}}, LinearAlgebra.UnitUpperTriangular{T, <:StaticArraysCore.StaticArray{Tuple{var"#s21", var"#s22"}, T, 2} where {var"#s21", var"#s22"}}, LinearAlgebra.UpperTriangular{T, <:StaticArraysCore.StaticArray{Tuple{var"#s15", var"#s16"}, T, 2} where {var"#s15", var"#s16"}}, StaticArraysCore.StaticArray{Tuple{var"#s25"}, T, 1} where var"#s25", StaticArraysCore.StaticArray{Tuple{var"#s1", var"#s3"}, T, 2} where {var"#s1", var"#s3"}, StaticArraysCore.StaticArray{<:Tuple, T}} where T) at ~/.julia/packages/StaticArrays/jA1zK/src/abstractarray.jl:1

length(!Matched::Union{LinearAlgebra.Adjoint{T, S}, LinearAlgebra.Transpose{T, S}} where {T, S}) at /opt/julia-1.8.3/share/julia/stdlib/v1.8/LinearAlgebra/src/adjtrans.jl:172

...

    (::Main.PlutoRunner.var"#121#122")(::Plots.Series)@PlutoRunner.jl:1589
    MappingRF@reduce.jl:95[inlined]
    _foldl_impl(::Base.MappingRF{Main.PlutoRunner.var"#121#122", Base.BottomRF{typeof(Base.add_sum)}}, ::Int64, ::Vector{Plots.Series})@reduce.jl:62
    foldl_impl@reduce.jl:48[inlined]
    mapfoldl_impl@reduce.jl:44[inlined]
    _mapreduce_dim@reducedim.jl:362[inlined]
    #mapreduce#765@reducedim.jl:357[inlined]
    #_sum#775@reducedim.jl:999[inlined]
    #sum#773@reducedim.jl:995[inlined]
    approx_size(::Plots.Plot{Plots.GRBackend})@PlutoRunner.jl:1588
    pluto_showable(::MIME{Symbol("image/svg+xml")}, ::Plots.Plot{Plots.GRBackend})@PlutoRunner.jl:1603
    mimetype(::Plots.Plot{Plots.GRBackend})@PlutoRunner.jl:1136
    show_richest(::IOContext{IOBuffer}, ::Any)@PlutoRunner.jl:1149
    show_richest_withreturned@PlutoRunner.jl:1095[inlined]
    format_output_default(::Any, ::Any)@PlutoRunner.jl:995
    #format_output#61@PlutoRunner.jl:1012[inlined]
    #53@PlutoRunner.jl:904[inlined]
    var"#with_io_to_logs#115"(::Bool, ::Base.CoreLogging.LogLevel, ::typeof(Main.PlutoRunner.with_io_to_logs), ::Main.PlutoRunner.var"#53#56"{Module, Plots.Plot{Plots.GRBackend}, Dict{Tuple{UInt64, Int64}, Int64}})@PlutoRunner.jl:2386
    (::Main.PlutoRunner.var"#119#120"{Bool, Base.CoreLogging.LogLevel, Main.PlutoRunner.var"#53#56"{Module, Plots.Plot{Plots.GRBackend}, Dict{Tuple{UInt64, Int64}, Int64}}})()@PlutoRunner.jl:2410
    with_logstate(::Function, ::Any)@logging.jl:511
    with_logger@logging.jl:623[inlined]
    #with_logger_and_io_to_logs#118@PlutoRunner.jl:2409[inlined]
    var"#formatted_result_of#50"(::Bool, ::typeof(Main.PlutoRunner.formatted_result_of), ::Base.UUID, ::Base.UUID, ::Bool, ::Vector{String}, ::Nothing, ::Module)@PlutoRunner.jl:903
    top-level scope@WorkspaceManager.jl:527

Perhaps if you showed the Julia code that generated this error, someone might be able to identify what’s going wrong.

2 Likes
using SankeyPlots
import PlotUtils: palette
src=[1, 1, 4]
dst=[2,3,2]
weights=[2,2,10.8]
sankey(src,dst,weights)
1 Like

It looks like there’s a bug in the way Pluto.jl handles plots created by SankeyPlots.jl.

The error is from this line in Pluto.jl/PlutoRunner.jl.