Colorbar_title position & orientation

When dealing with several 2.5 d plots at the same time, it’s nice to indicate what the colorbar stands for.
To do so, we have the colorbar_title attribute, now even supported by GR. I assume, with long titles in mind, it puts the colorbar_title in vertical orientation right next to the colorbar, e.g. this example:
cbtitle

This is not always the most legible way. Especially with shorter titles, it would be nice to be able to tell colorbar_title to be in :horizontal orientation.
On top of this, it would be great to have a second line just above the colorbar to annotate units. The units could even have a bit smaller font szie than the title text.
So what I am looking for is something like this:
CBT_MyTitle

Is some of this already implemented and I have overlooked it?
What would be a robust way to place the colorbar_title in horizontal orientation ontop of the colorbar?
With robust I mean a better response to the positioning than me using annotate = (x,y,"MyCBTitle")
Which is not so useful when later composing plots with @layout.
Any suggestions are very welcome.

Hello, I know that you are looking for something that works with Plots. I do not have a solution with Plots, however I can do what you are asking for with Gnuplot.jl. Take a look at the examples(and yes you need to play around a little with some parameters, but not much).

  1. Single plot:
using Gnuplot, Random
Random.seed!(123)
test = rand(50,50)
@gp "set auto fix" "set size square" :-
@gp :- test "w image notit"  """set cblabel "CBTitle \\n (my unit)" """ :-
@gp :- "set cblabel  offset -6.5, 10 font ',8' textcolor lt 3 rotate by 0" :-
@gp :- palette(:plasma) :-
@gp :- "set tmargin at screen 0.90"
save(term = "pngcairo size 400,400", output = "colorbar_labels_single.png")

colorbar_labels_single
2. Multiplot

1 Like
using Gnuplot, Random
Random.seed!(123)
test = rand(50,50)
@gp "set multiplot layout 1,2"
# on top
@gp :- 1 "set auto fix" "set size square" :-
@gp :- test "w image notit"  """set cblabel "CBTitle \\n (my unit)" """ :-
@gp :- "set cblabel offset -6.5, 10 font ',8' textcolor lt 3 rotate by 0" :-
@gp :- "set tmargin at screen 0.85" :-
# on the side
@gp :- 2 "set auto fix" "set size square" :-
@gp :- test "w image notit"  """set cblabel "CBTitle (my unit)" """
@gp :- "set cblabel offset 0, 0 font ',8' textcolor lt 4 rotate by 90" :-
@gp :- palette(:viridis) :-
@gp :- "set rmargin at screen 0.9"
save(term = "pngcairo size 800,400", output = "colorbar_labels_layout.png")