# Single colorbar for heatmap grid layout

**URL:** <https://discourse.julialang.org/t/single-colorbar-for-heatmap-grid-layout/50609>\
**Category:** General Usage\
**Tags:** question, plots\
**Created:** [November 23, 2020, 4:03am UTC](https://discourse.julialang.org/t/single-colorbar-for-heatmap-grid-layout/50609 "2020-11-23T04:03:48Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![tomaklutfu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomaklutfu/32/2411_2.png) [@tomaklutfu](https://discourse.julialang.org/u/tomaklutfu)\
**Post date:** [November 23, 2020, 10:36am UTC](https://discourse.julialang.org/t/single-colorbar-for-heatmap-grid-layout/50609/4 "2020-11-23T10:36:23Z")

</div>

This does what you want but not directly.

```julia
julia> ps = [heatmap(rand(10,10), legend=:none) for i=1:2,j=1:2] # Make heatmaps without legends
2×2 Matrix{Plots.Plot{Plots.GRBackend}}:
 Plot{Plots.GRBackend() n=1} Plot{Plots.GRBackend() n=1}
 Plot{Plots.GRBackend() n=1} Plot{Plots.GRBackend() n=1}

julia> l = @layout[grid(2,2) a{0.05w}] # Stack a layout that rightmost one is for color bar
Plots.GridLayout(1, 2)

julia> p = plot(ps..., heatmap((0:0.01:1).*ones(101,1), legend=:none, xticks=:none, yticks=(1:10:101, string.(0:0.1:1))), layout=l) # Plot them set y values of color bar accordingly

julia> savefig(p, "plot.png")

```

![plot](https://global.discourse-cdn.com/julialang/original/3X/4/5/45bac3953a75903c2cb121e0f436b52e1b0855c2.png)

---

_[View the full topic](https://discourse.julialang.org/t/single-colorbar-for-heatmap-grid-layout/50609)._
