# Plotting a vector of vector in julia

**URL:** <https://discourse.julialang.org/t/plotting-a-vector-of-vector-in-julia/93797>\
**Category:** General Usage\
**Tags:** plotting, plots\
**Created:** [January 31, 2023, 12:39am UTC](https://discourse.julialang.org/t/plotting-a-vector-of-vector-in-julia/93797 "2023-01-31T00:39:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaurya](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shaurya/32/30468_2.png) [@shaurya](https://discourse.julialang.org/u/shaurya)\
**Post date:** [January 31, 2023, 12:39am UTC](https://discourse.julialang.org/t/plotting-a-vector-of-vector-in-julia/93797/1 "2023-01-31T00:39:29Z")

</div>

I have a vector of vector elements, given as follows:

```julia
 sol=[[1,2,3],[1,1,1],[4,3,2],[5,1,3],[9,4,1]];
 plot(sol)

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/c/4c9fd46a37eb487c054f526f1092215463651d8e.png)

The above code snippet plots in julia assuming that sol has 3 measurements, and each measurement has 5 components. Performing ` typeof(sol)` would give this:` Vector{Vector{Int64}} (alias for Array{Array{Int64, 1}, 1})`

Instead, my data actually has actually has 5 measurements, and 3 components. I’ve included the desired plot (from MATLAB.)

 ![IMG_0531](https://global.discourse-cdn.com/julialang/original/3X/3/5/3589c17252c8983861c1b723ddd2c8e8bc78e00d.png)

How can I plot the same in Julia? Thanks!

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 31, 2023, 12:47am UTC](https://discourse.julialang.org/t/plotting-a-vector-of-vector-in-julia/93797/2 "2023-01-31T00:47:54Z")

</div>

Try:

```julia
sol2 = reduce(hcat, sol)'
plot(sol2)

```

---

<div class="post-metadata">

**Author:** ![shaurya](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shaurya/32/30468_2.png) [@shaurya](https://discourse.julialang.org/u/shaurya)\
**Post date:** [January 31, 2023, 12:53am UTC](https://discourse.julialang.org/t/plotting-a-vector-of-vector-in-julia/93797/3 "2023-01-31T00:53:46Z")

</div>

Thank you so much! That solves it! 😃
