How to add a text string outside the map area

For example, I have a map with “Robinson” projection. I want to put a text string on the top right corner of the figure, outside the map plotting area. How do I do that?

Below is how I add text to the map area. Unfortunately, it can not be used to add text outside the map area. For example, a text string floating outside the rightside of the map will go to left side of the map area.

text!(["500m"], x=190, y=38);

Thanks

Leo, the problem here is that you want your text to be in outer space so you can’t plot it while the geographic coordinates are active. You’ll need to start a new paper space with the same size as the one used by the projected figure (14 cm wide by default) and use paper coordinates this time. Don’t remember on top of my head of a example that does that (though it exists for sure). Somethings like

text!(region=(0,16,0,16), figsize=(14,14), text="500 m", x=14, y=14, justify=:TR, frame=:none)
1 Like

It works! Thank you so much, Joaquim!

The only issue is that the new frame seems to be within a certain area only.

Please check out part of my map in this link:

Is there a way I can move the text string further down (closer to the colorbar) a little bit?

Here is my current code:
text!(region=(0,16,0,8), figsize=(16,8), text="$(Year) [historical]",
x=14.1, y=0.2, justify=:TR, frame=:none);

If I change y to 0 or a negative number, the text string will disappear entirely.

If you remove the frame=:none you’ll see immediately what is happening.
However, one thing I don’t understand is why the second frame does not align with the bottom of projected image. @pwessel is it because the colorbar further extended it down?

Anyway, the solution to your case is the option noclip=true

1 Like

Many thanks, Joaquim. I’m now able to get what I want by using “noclip=true”.

Much easier now with the paper option to plot (and its avatars) and text modules.

See example at https://www.generic-mapping-tools.org/GMTjl_doc/examples/misc/mix_paper_geog/