MethodError: no method matching Plot(::Vector{Any}, ::Layout{Dict{Symbol, Any}})

scatter_data = [];
for col in names(国家财政收入)[2:3]
    国家财政收入[!, col] .= (国家财政收入[!, col] ./ 财政收入合计)
    push!(scatter_data, scatter(国家财政收入, x = :年份, y = :col, name = col))
end

scatter_data

returns

2-element Vector{Any}

while the wanted type is

2-element Vector{GenericTrace{Dict{Symbol, Any}}}

since when execute

plot(
    scatter_data,
    Layout(
        title = "各项税收",
        xaxis = attr(dtick = "M12", tickangle = -45, tickformat="%b\n%Y")
    ))

gives

ERROR: MethodError: no method matching Plot(::Vector{Any}, ::Layout{Dict{Symbol, Any}})

how should my code be modified to plot them properly

Hi,
I am not sure what variable you iterate over nor where GenericTrace{Dict{Symbol, Any}} is from, but if you set your first line to

scatter_data = GenericTrace{Dict{Symbol, Any}}[]

Your vector has the type you want (hoping that scatter also returns such a type, otherwise your push! will error.

For type T the command T[] creates and empty vector with that type as element type.