Open dmetivie opened 1 month ago
Or create a label_position
attribute
(maybe without the underscore to match the rest of the API)
to move the label to a specific position:
:right
(default for the vertical colorbar), :left
, :bottom
, and :top
(the latter being desired here) ?
That would work with an horizontal colorbar as well, with clear meaning ?
colorbar already has a flip option which also flips the label, so that would also factor into it I guess
That would be great!
If you want to get around spacing issues, here's a solution for the interim:
using CairoMakie, GeoMakie
fig = Figure(size = (400, 600))
a1, p1 = meshimage(fig[1, 1], -180..180, -90..90, rotr90(GeoMakie.earth()); axis = (; type = GeoAxis, dest = "+proj=moll"))
a2, p2 = meshimage(fig[2, 1], -180..180, -90..90, rotr90(GeoMakie.earth()); axis = (; type = GeoAxis, dest = "+proj=ortho"))
# now define the colorbar
cb_cell = fig[1:2, 2] = GridLayout() # treat the colorbar-and-label system as a single grid cell
rowgap!(cb_cell, 5) # set this or don't
cb = Colorbar(cb_cell[2, 1], #= ... =#)
cb_label = Label(cb_cell[1, 1], "hPa"; tellheight = true, tellwidth = false)
fig
Feature description
It would be cool to have the option to place a
title
(orlabel
, not sure of the most appropriate name) on top (and why not bottom) of verticalcolorbar
. With Matplotlib I would useclb.ax.set_title
. This is useful for short title (like units).So far, the Julia community gave me two tricks on Zulip to do it in simple situation by adding a label manually on top
Label(fig[0,2], text = "Hello")
or creating an empty figure on top.However, in complex situation this does not work simply (I typically use GeoMakie.jl and due to spacing issues I have to use
rowgap!
which move the addedcolobar
title. In any case, a simple title option would be better. Not sure how it would work with horizontalcolorbar
.For plot types, please add an image of how it should look like
Here is an example with Matplotlib (and Cartopy), the
title
place thehPa
on top of thecolobar
.