Legend in a map with Magics


I've been creating maps with Magics using ct.map.plot(...). Now I would like to add a unit to the legend, but this seems to be unexpectedly difficult.

The most obvious solution is perhaps to use the keyword legend_title, which is not described in the Toolbox how-to guide, but can be found in the Magics documentation. This does produce a legend title, but unfortunately it is being plotted more or less on top of the legend, and therefore unreadable. There are a few other options described in the Magics documentation, such as legend_title_position_ratio, increasing this number has however the unfortunate effect that the legend itself is being squeezed at the expense of the legend title, which doesn't look very good at all.

There is also a keyword legend_user_maximum with the description "Use of user tailored text for maximum". Presumably this allows the user to specify a specific text string for the maximum value of the legend, which could be another good solution. However when I tried this from within the Toolbox it didn't seem to have any effect (so no text was being shown, just the maximum value).

Another solution could be to use text plotting at a specified location on the plot; again when I tried this it didn't seem to make any difference at all. The keyword mtext is also not listed as a parameter for ct.map.plot(), so perhaps this is not implemented in the Toolbox? 

The best solution I've been able to come up with so far is to plot the units as a subtitle to the main plot (as described in the how-to guide), however this puts the main title quite a bit further up the plot, and the subtitle is (if you look carefully) still overlapping with the legend labels, see the attached screenshot. 

So does anyone have any suggestions or examples on how to add a units string to the legend in a Magics plot? Any pointers would be greatly appreciated!

Many thanks in advance


Dear Rutger,

I have been struggling with this Magics issue too and the best workaround I have found it to use a subtitle as you did.

You could add an empty line as a subsequent subtitle to avoid the overlap with the actual legend. I am sorry that this is the best advice I can give you right now.

Best regards.


Hi Vivien

Great, thanks - good to know. And a useful tip!