# VegaLite.jl plot from multiple columns

**URL:** https://discourse.julialang.org/t/vegalite-jl-plot-from-multiple-columns/55879
**Category:** New to Julia
**Tags:** vega
**Created:** [February 23, 2021, 7:38pm UTC](https://discourse.julialang.org/t/vegalite-jl-plot-from-multiple-columns/55879 "2021-02-23T19:38:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![davide-f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davide-f/32/33780_2.png) [@davide-f](https://discourse.julialang.org/u/davide-f)
#### Post date: [February 23, 2021, 7:38pm UTC](https://discourse.julialang.org/t/vegalite-jl-plot-from-multiple-columns/55879/1 "2021-02-23T19:38:35Z")

</div>

Dear Community,  
I would like to plot a stacked plot with VegaLite.jl and the stacked bars come from different columns.  
In particular, I would like to obtain a format like the one below, but with a different structure of the DataFrame

```julia
a = DataFrame(col1=repeat(1:3,2), col2=repeat(["a", "b"], inner = 3), col3=10:15)
a |> @vlplot(:bar, x="col1:o", y={"col3", axis={stack=nothing}}, color=:col2)

```

The output is  
 ![sssss](https://global.discourse-cdn.com/julialang/original/3X/0/a/0a65a40c79011456a964402ab3f3d3d67b62b958.png)

In particular, the structure of the DataFrame that I would like to use is the following, where the information of the different bars are spread over multiple columns.

```julia
b = DataFrame(col1=1:3, a=10:12, b=13:15)

```

How can I use DataFrame b to create the same image as in the a case efficiently?  
The idea I see is to transform DataFrame a into b, but it may be inefficient.  
Obviously the problem above is very simplified, in my case the number of columns is large and reading them by rows is also easy to debug, use, etc.
