JuliaPlots/Plots.jl

[BUG] Nested `plot` calls seem to cause bugs with axis linking

Open

#2767 aperta il 8 giu 2020

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Julia (381 fork)batch import
buggood first issue

Metriche repository

Star
 (1943 star)
Metriche merge PR
 (Merge medio 3g 12h) (2 PR mergiate in 30 g)

Descrizione

Consider the following MWE:

plot(
    [
    plot(
        plot(rand(subdf)); 
        title = title
    ) 
    for (subdf, title) in zip(1:30, string.('A':('A' + 30)))
    ]...; 
    size = (2000, 2000),
    legend = :none, 
    link = :all
)

This produces the following error:


ERROR: KeyError: key :xaxis not found
Stacktrace:
[1] getindex
  @ /Applications/Julia-1.5.app/Contents/Resources/julia/bin/../share/julia/base/dict.jl:467 [inlined]

[2] #146(sp::Plots.GridLayout)
  @ Plots ./none:0

[3] iterate
  @ /Applications/Julia-1.5.app/Contents/Resources/julia/bin/../share/julia/base/generator.jl:47 [inlined]

[4] collect(itr::Base.Generator{Array{Any,1},Plots.var"#146#147"{Symbol}})
  @ Base /Applications/Julia-1.5.app/Contents/Resources/julia/bin/../share/julia/base/array.jl:688

[5] link_axes!(a::Array{AbstractLayout,2}, axissym::Symbol)
  @ Plots ~/.julia/dev/Plots/src/layouts.jl:762

[6] link_axes!(layout::Plots.GridLayout, link::Symbol)
  @ Plots ~/.julia/dev/Plots/src/layouts.jl:796

[7] #plot#123(kw::Base.Iterators.Pairs{Symbol,Any,NTuple{6,Symbol},NamedTuple{(:size, :tickfontsize, :titlefontsize, :legend, :link, :margin),Tuple{Tuple{Int64,Int64},Int64,Int64,Symbol,Symbol,Measures.Length{:mm,Float64}}}}, ::typeof(plot), plt1::Plots.Plot{Plots.GRBackend}, plts_tail::Plots.Plot{Plots.GRBackend})
  @ Plots ~/.julia/dev/Plots/src/plot.jl:108

[8] top-level scope
  @ REPL[59]:1

However,

plot(
    [
    plot(
        rand(subdf); 
        title = title
    ) 
    for (subdf, title) in zip(1:30, string.('A':('A' + 30)))
    ]...; 
    size = (2000, 2000),
    legend = :none, 
    link = :all
)

works as expected.

This looks like a bug in Plots.

Guida contributor