Different alignment options for -B+t

The plot title set via -B+t is always centered (2). I could make good use of an option to align it with the left (1) or right (3) map frame as in the mockup below.

Currently I’m using gmt text to achieve this but this is pretty tedious. I can’t really automate that step.

Maybe there is an undocumented option similar to -B+tr"HAWAII" to achieve (3) or -B+tl"HAWAII" to achieve something like (1)? And yes, I tried those just to be sure :wink:

Your ideas how to achieve this are greatly appreciated!

Some code to play with (adjusted to use default fonts):

gmt begin map_style
  gmt set FORMAT_GEO_OUT ddd:mm:ssG
  gmt set MAP_FRAME_TYPE plain
  gmt set MAP_FRAME_AXES WESN
  gmt set MAP_FRAME_PEN 1.8p,black
  gmt set MAP_GRID_PEN 0.7p,black
  gmt set MAP_TICK_LENGTH 0
  gmt set MAP_ANNOT_OFFSET 6.5p
  gmt set FONT_ANNOT Helvetica,13p
  gmt set FONT_TITLE Helvetica-Bold,15p
  gmt set PS_LINE_JOIN round
  gmt coast -RUS.HI+e1 -N1/6p,white -W0.7p,black -B+f -Bg -B+t"HAWAII"
  gmt coast -W2.7p,white
  gmt coast -W0.7p,black
gmt end show

+1 for this.

Given the numerous modifiers for -B I cannot see how we can do this via a modifier, like +l and +r since +l is already used. The +tr and +tl run into non uniqueness. The quotes are not seen by GMT anyway so hopeless to separate +trms into right-justified “ms” or entered rms.
Remaining trick would be to introduce a new default setting MAP_TITLE_JUST with default value of TC. You could then achieve your left-centred title by adding --MAP_TITLE_JUST=TL. Or we restrict it to the top only and allow L, C, R only.

I have another idea. We can imitate Markdown where :- and -: means left and right alignment respectively. So ":-My left wing`` would be left aligned. It has the further advantage that this mechanism could be applied to all text placements that accept left-right alignment.

Gentlemen, thank you for entertaining the idea.

Joaquim’s idea appeals to me because of its simplicity (I’m pretty sure I’ll need a mnemonic for remembering on which side the dash needs to go …).

Following Paul’s thoughts, MAP_TITLE_JUST has some charm to it as it allows way more options:

I do like the BR version with -B+t+s. Currently I can’t imagine a use case for the L* and R* versions but who am I to decide.

What do you think?

Bonus idea after staring at the mock-up for way too long: For total madness the justification AA would print the title at all twelve locations at once … :wink:

2 Likes

Would @pwessel and @Joaquim consider a feature request over on GitHub worthwhile? In the meantime some hypothetical -B+t+s eye candy without red stuff:

Sure that you can make a feature request.

Feature request opened over on GitHub.