# Empty plot with colorbar and colorbar width

**URL:** <https://discourse.julialang.org/t/empty-plot-with-colorbar-and-colorbar-width/128673>\
**Category:** Visualization\
**Tags:** plots, gr\
**Created:** [May 3, 2025, 7:24pm UTC](https://discourse.julialang.org/t/empty-plot-with-colorbar-and-colorbar-width/128673 "2025-05-03T19:24:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PharmCat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pharmcat/32/6953_2.png) [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Post date:** [May 3, 2025, 7:24pm UTC](https://discourse.julialang.org/t/empty-plot-with-colorbar-and-colorbar-width/128673/1 "2025-05-03T19:24:58Z")

</div>

I’m using Plots with GR

Is it possible to make empty plot with colorbar?

I try:

```julia
plot(;colorbar=true, clims = (-0.05, 0.05),c = cg, zcolor = 1)

```

colorbar - not displayed.

Is it possible to change width of colorbar?

---

<div class="post-metadata">

**Author:** ![PharmCat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pharmcat/32/6953_2.png) [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Post date:** [May 3, 2025, 7:29pm UTC](https://discourse.julialang.org/t/empty-plot-with-colorbar-and-colorbar-width/128673/2 "2025-05-03T19:29:01Z")

</div>

I try to do something like this:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/9/c/9c43c8f1379d958cfe5319cabbd825efd1e577d7.jpeg)

But now it looks very bad.

---

<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:** [May 3, 2025, 8:01pm UTC](https://discourse.julialang.org/t/empty-plot-with-colorbar-and-colorbar-width/128673/3 "2025-05-03T20:01:29Z")

</div>

> [@PharmCat](#):
>
> Is it possible to change width of colorbar?

I would use a layout and instead of the colorbar I would plot a heatmap with only the y-axis labels. See [this solution](https://discourse.julialang.org/t/setting-the-foreground-color-of-colorbar-tick-marks/122911/4).

---

<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:** [May 3, 2025, 8:18pm UTC](https://discourse.julialang.org/t/empty-plot-with-colorbar-and-colorbar-width/128673/4 "2025-05-03T20:18:08Z")

</div>

> [@PharmCat](#):
>
> Is it possible to make empty plot with colorbar?

Unrelated to the previous answer, for this you need to plot some dummy data (ex: NaN), and use `framestyle=:none`

```julia
plot([1], [NaN]; colorbar=true, clims=(-0.05, 0.05), c=cgrad([:blue, :red]), framestyle=:none)

```
