# Makie/CairoMakie custom colorbar ticks (\> and \<)

**URL:** <https://discourse.julialang.org/t/makie-cairomakie-custom-colorbar-ticks-and/104460>\
**Category:** Visualization\
**Tags:** cairomakie\
**Created:** [October 1, 2023, 10:11am UTC](https://discourse.julialang.org/t/makie-cairomakie-custom-colorbar-ticks-and/104460 "2023-10-01T10:11:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ewillcox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ewillcox/32/22980_2.png) [@ewillcox](https://discourse.julialang.org/u/ewillcox)\
**Post date:** [October 1, 2023, 10:11am UTC](https://discourse.julialang.org/t/makie-cairomakie-custom-colorbar-ticks-and/104460/1 "2023-10-01T10:11:45Z")

</div>

Hello,

I’d like to customize my Colorbar() ticks in Makie/CairoMakie

I have reduced the colorrange on a graph since I have outliers that I do wish to display but don’t wish to have impact my colormap. Currently the ticks on the bar are the same as the colorrange even though this is actually inaccurate.

In reality they are from “\< min value” to “\> max value”. The rest of the ticks can of course be regular. Something like matplotlib’s cbar.ax.set\_yticklabels().

I have not so far managed to find this in the docs so any help is welcome! Thanks!

---

<div class="post-metadata">

**Author:** ![JonasWickman](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@JonasWickman](https://discourse.julialang.org/u/JonasWickman)\
**Post date:** [October 2, 2023, 3:34pm UTC](https://discourse.julialang.org/t/makie-cairomakie-custom-colorbar-ticks-and/104460/2 "2023-10-02T15:34:02Z")

</div>

You can adjust the ticks and ticklabels of colorbars in (at least) two ways. At construction:

```julia
xs = ys = range(-1, 1, length = 101)
Z = xs.^2 .+ ((ys)').^2
fig = Figure()
ax = Axis(fig[1,1])
hm = heatmap!(ax, xs, ys, Z)
cbar = Colorbar(fig[1,2], hm; ticks = ([0.5,1.0,1.5], ["Low","Medium","High"]))
fig

```

or after construction:

```julia
cbar.ticks[] = ([0.5,1.0,1.5], ["0.5","1.0","1.5"])

```

I could not fully understand what problem you are trying to solve specifically, please provide an MWE ([Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757)) if the above is not sufficient to solve your problem.

---

<div class="post-metadata">

**Author:** ![ewillcox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ewillcox/32/22980_2.png) [@ewillcox](https://discourse.julialang.org/u/ewillcox)\
**Post date:** [October 3, 2023, 7:08pm UTC](https://discourse.julialang.org/t/makie-cairomakie-custom-colorbar-ticks-and/104460/3 "2023-10-03T19:08:37Z")

</div>

That’s perfect, thank you. I didn’t realize I could put two arrays into ticks like that.
