# Reverse Makie Colorbar

**URL:** https://discourse.julialang.org/t/reverse-makie-colorbar/125659
**Category:** General Usage
**Tags:** makie
**Created:** [February 7, 2025, 3:03pm UTC](https://discourse.julialang.org/t/reverse-makie-colorbar/125659 "2025-02-07T15:03:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![JoergF](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@JoergF](https://discourse.julialang.org/u/JoergF)
#### Post date: [February 7, 2025, 3:03pm UTC](https://discourse.julialang.org/t/reverse-makie-colorbar/125659/1 "2025-02-07T15:03:28Z")

</div>

I was wondering if there is any possibility to reverse the ticks in a Colorbar. I.e. instead of counting up 1:4 doing something like 4:-1:1.  
This snippet however still has 1 at the bottom and 4 at the top

```julia
fig = Figure(size = (100, 400))
cmap = cgrad(to_colormap(:cividis), 4, categorical = true)
Colorbar(
	fig[1, 1], 
	limits = (0.5, 4+.5), ticks = 4:-1:1, nsteps = 4
	, colormap = cmap
)
fig

```

Is there any other “easy” way of achieving this reverted axis behavior?

---

<div class="post-metadata">

### Author: ![barucden](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barucden/32/26154_2.png) [@barucden](https://discourse.julialang.org/u/barucden)
#### Post date: [February 7, 2025, 3:27pm UTC](https://discourse.julialang.org/t/reverse-makie-colorbar/125659/2 "2025-02-07T15:27:04Z")

</div>

![test](https://global.discourse-cdn.com/julialang/original/3X/8/8/88fd35bf97b7ff506e53212d412e78daff5a4ed2.png)

Like so?

```julia
using CairoMakie
fig = Figure(size=(100, 400))
cmap = cgrad(to_colormap(:cividis), 4, categorical = true)
Colorbar(fig[1, 1], limits=(0, 4), colormap=cmap, ticks=(1:4, string.(4:-1:1)))

```

---

<div class="post-metadata">

### Author: ![JoergF](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@JoergF](https://discourse.julialang.org/u/JoergF)
#### Post date: [February 10, 2025, 10:18am UTC](https://discourse.julialang.org/t/reverse-makie-colorbar/125659/3 "2025-02-10T10:18:26Z")

</div>

Thank you very much! It’s not exactly what I needed, but it’s definitely helping me a lot 🙂
