# Attributes (in particular width) of the colorbar in Plots.jl

**URL:** <https://discourse.julialang.org/t/attributes-in-particular-width-of-the-colorbar-in-plots-jl/32225>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [December 13, 2019, 10:06am UTC](https://discourse.julialang.org/t/attributes-in-particular-width-of-the-colorbar-in-plots-jl/32225 "2019-12-13T10:06:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rad1um](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rad1um/32/8483_2.png) [@rad1um](https://discourse.julialang.org/u/rad1um)\
**Post date:** [December 13, 2019, 10:06am UTC](https://discourse.julialang.org/t/attributes-in-particular-width-of-the-colorbar-in-plots-jl/32225/1 "2019-12-13T10:06:19Z")

</div>

How do I change the attributes of the colorbar in Plots? In particular I would like to change the width and change the location, s.t. it is directly next to the corresponding plot.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [December 13, 2019, 10:17am UTC](https://discourse.julialang.org/t/attributes-in-particular-width-of-the-colorbar-in-plots-jl/32225/2 "2019-12-13T10:17:24Z")

</div>

Can you provide a small example of what your plot currently looks like together with the code that generated the plot? It would make it easier to answer your question.

---

<div class="post-metadata">

**Author:** ![rad1um](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rad1um/32/8483_2.png) [@rad1um](https://discourse.julialang.org/u/rad1um)\
**Post date:** [December 13, 2019, 10:20am UTC](https://discourse.julialang.org/t/attributes-in-particular-width-of-the-colorbar-in-plots-jl/32225/3 "2019-12-13T10:20:34Z")

</div>

Sure.

```julia
using Plots

x=rand(10)
y=rand(10)
zvals=rand(10)

scatter(x,y,
    xguidefontsize=18, yguidefontsize=18,
    label = "",
    size = (700,400),
    #colorbar =:best,
    marker_z = zvals,
    seriescolor=:cividis,
    markersize = 10,
    tickfontsize = 14,
)

```

the `colorbar =` may be used to change the location of the colorbar.

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

---

<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, 6:58pm UTC](https://discourse.julialang.org/t/attributes-in-particular-width-of-the-colorbar-in-plots-jl/32225/4 "2025-05-03T18:58:18Z")

</div>

Is any idea how to change width of colorbar?

---

<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:24pm UTC](https://discourse.julialang.org/t/attributes-in-particular-width-of-the-colorbar-in-plots-jl/32225/5 "2025-05-03T20:24:39Z")

</div>

Take a look at [this solution](https://discourse.julialang.org/t/setting-the-foreground-color-of-colorbar-tick-marks/122911/4) where we use a layout and replace the colorbar with a heatmap with only the labels on the y-axis.
