Makie rotate colorbar label

How do I rotate the label on the colorbar in Makie?

MWE:

using CairoMakie

M = rand(10, 10)
fig = CairoMakie.Figure()
ax = Axis(fig[1,1])
cplot = CairoMakie.contourf!(fig[1,1], 1:10, 1:10, M)
Colorbar(fig[1,2], cplot, label="L")
fig

How can I rotate the colorbar label π/2 clockwise?

Aware that I can just have a horizontal colorbar with a correctly oriented label, but I don’t want a horizontal colorbar, I want a vertical colorbar

Check colorbar.elements, that dict should have a label text plot entry. On that object you can set the rotation like on any normal text. It’s not an exposed setting.

1 Like

Thanks, will have a look at that

Not sure if I’m doing it right, but I can’t see the entry

julia> Colorbar(fig[1, 2], cplot, label="L").elements
Dict{Symbol, Any} with 6 entries:
  :continuous_map  => Image{Tuple{StepRangeLen{Float32, Float64, Float64}, StepRangeLen{Float32, Float64, Float64}, Matrix{RGBA{Float32}}}}
  :spines          => Lines{Tuple{Vector{Point{2, Float32}}}}
  :axis            => LineAxis(Scene (800px, 600px):…
  :categorical_map => Combined{poly, Tuple{Vector{HyperRectangle{2, Float32}}}}
  :lowclip         => Combined{poly, Tuple{Vector{Point{2, Float32}}}}
  :highclip        => Combined{poly, Tuple{Vector{Point{2, Float32}}}}

Ah then it’s in axis and that one’s elements