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

**URL:** https://discourse.julialang.org/t/methoderror-no-method-matching-plot-vector-any-layout-dict-symbol-any/105501
**Category:** Visualization
**Tags:** plotting
**Created:** [October 28, 2023, 12:11pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-plot-vector-any-layout-dict-symbol-any/105501 "2023-10-28T12:11:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Stephen](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Stephen](https://discourse.julialang.org/u/Stephen)
#### Post date: [October 28, 2023, 12:11pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-plot-vector-any-layout-dict-symbol-any/105501/1 "2023-10-28T12:11:03Z")

</div>

```julia
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

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

```

since when execute

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

```

gives

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

```

how should my code be modified to plot them properly

---

<div class="post-metadata">

### Author: ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)
#### Post date: [October 28, 2023, 1:15pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-plot-vector-any-layout-dict-symbol-any/105501/2 "2023-10-28T13:15:52Z")

</div>

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

```julia
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.
