JuliaPlots/Plots.jl

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

Open

#2,767 建立於 2020年6月8日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)Julia (381 fork)batch import
buggood first issue

倉庫指標

Star
 (1,943 star)
PR 合併指標
 (平均合併 3天 12小時) (30 天內合併 2 個 PR)

描述

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.

貢獻者指南