# Color plot with a list

**URL:** <https://discourse.julialang.org/t/color-plot-with-a-list/91835>\
**Category:** General Usage\
**Tags:** question, plotting\
**Created:** [December 19, 2022, 8:06am UTC](https://discourse.julialang.org/t/color-plot-with-a-list/91835 "2022-12-19T08:06:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![saba](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@saba](https://discourse.julialang.org/u/saba)\
**Post date:** [December 19, 2022, 8:06am UTC](https://discourse.julialang.org/t/color-plot-with-a-list/91835/1 "2022-12-19T08:06:13Z")

</div>

Hi  
I have a big list which contains some other lists. It’s for example like this A=[[1,2,3] , [4,5,6] , [7,8,9] ]. How can I plot a heatmap for this? or any other types of colormaps.  
My actual list information:  
typeof: Vector{Any} (alias for Array{Any, 1})  
size: (99,)

---

<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:** [December 19, 2022, 10:36pm UTC](https://discourse.julialang.org/t/color-plot-with-a-list/91835/2 "2022-12-19T22:36:05Z")

</div>

Your example `A` has the type: `Vector{Vector{Int64}}`, while your actual list type is said to be: `Vector{Any}`.  
Where do we stand?

For the former you can try: `heatmap(reduce(hcat,A))`, or of its transpose.

---

<div class="post-metadata">

**Author:** ![rmsmsgood](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rmsmsgood/32/20544_2.png) [@rmsmsgood](https://discourse.julialang.org/u/rmsmsgood)\
**Post date:** [December 20, 2022, 1:45am UTC](https://discourse.julialang.org/t/color-plot-with-a-list/91835/3 "2022-12-20T01:45:08Z")

</div>

Tip. If you got a list of lists `A` as `Vector{Vector{Real}}`, then `heatmap(hcat(A...))` is equivalent to `heatmap(reduce(hcat,A))`.

---

<div class="post-metadata">

**Author:** ![saba](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@saba](https://discourse.julialang.org/u/saba)\
**Post date:** [December 23, 2022, 3:48pm UTC](https://discourse.julialang.org/t/color-plot-with-a-list/91835/4 "2022-12-23T15:48:47Z")

</div>

Thanks. What dose the `reduce()` do in this example?

---

<div class="post-metadata">

**Author:** ![saba](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@saba](https://discourse.julialang.org/u/saba)\
**Post date:** [December 23, 2022, 3:52pm UTC](https://discourse.julialang.org/t/color-plot-with-a-list/91835/5 "2022-12-23T15:52:40Z")

</div>

Thanks. So I should change the A type?

---

<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:** [December 23, 2022, 3:56pm UTC](https://discourse.julialang.org/t/color-plot-with-a-list/91835/6 "2022-12-23T15:56:45Z")

</div>

> [@saba](#):
>
> What does the `reduce()` do in this example?

I am just a user, but I think for the vector `A` of 3 vectors, it does something equivalent to the successive application of `hcat`:

```julia
hcat(hcat(A[1], A[2]), A[3])

```

---

<div class="post-metadata">

**Author:** ![saba](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@saba](https://discourse.julialang.org/u/saba)\
**Post date:** [December 26, 2022, 7:08am UTC](https://discourse.julialang.org/t/color-plot-with-a-list/91835/7 "2022-12-26T07:08:11Z")

</div>

Thanks
