How to plot title with a subtitle on a newline

Is there a way to plot a title on two lines instead of one? I.e. Something like a title and a subtitle. I have some long titles that I would like to break onto a newline, but using \n doesn’t seem to work:

gmt basemap -R0/1/0/1 -JX1 -Baf+t"Title\nSubtitle" -png map

map

This comes up from time to time; perhaps time to make it a feature request, @weiji14? It should not be too hard to implement: Count the \n, then break into line with last line going where current single-line titles goes and work upwards with some sense of line-spacing derived from font size.

Ah, would have thought this was fairly common. I’ve opened up a feature request at https://github.com/GenericMappingTools/gmt/issues/4557.

In the meantime, I’ll try making a hacky workaround using legend :see_no_evil:

I did it using text (e.g.):

echo $titlIND1 | gmt text -F+cTR -D0c/0.6c -N

I’m trying to do something similar to this where I have a title and I want a subtitle that is of the data of an earthquake. I tried the gmt text approach (using classic mode)
echo $ename | gmt pstext -J$proj -R$LONMIN/$LONMAX/$LATMIN/$LATMAX \ -F+f32p,Times-Roman+cCT -D0c/0.6c -N -K -O >> $psfile

This is an iterative loop for multiple events so I need some dynamic variables. The problem I’m having is this is plotting the text just outside the framed boarder and I want the text just inside the actual map. I can migrate this text inside the map if I have to with Illustrator but there are a ton of events to do so any way I can reduce the amount of post processing fixes, the better. Here is an example of what it looks like from this line of code. As you can see, it interferes with the map tic marks. Any advice on how to improve this is appreciated.

Hi @jpschmidt is the map size always the same? Tweaking -D didn’t do the trick for you?

1 Like

Thanks for pointing that out. I didn’t think to play with the -D flag. I set the -D flag to -D0c/-1.0c for negative displacement and that worked great.