How to plot title with a subtitle on a newline

Thank you for your advice!

Hello! I’m wondering if there is similar functionality for labels (in PyGMT)? I would love to split my colorbar label across two lines of text if possible, for example splitting at the colon in the below case.

fig.colorbar(cmap=True, box="+c.25+gwhite+p1.5", position="JCR+o1.3/0c+n", frame=['x+l"Temperature Residual: Observation minus Model"'])

Unfortunately the subtitle feature is only for titles/headings (see Support for multi-line plot titles and introducing subtitles (also supporting multi-lines) by PaulWessel · Pull Request #4562 · GenericMappingTools/gmt · GitHub). You could try adjusting the FONT_LABEL config perhaps to get the text to fit?

import pygmt

fig = pygmt.Figure()
fig.basemap(region=[0, 5, 10, 15], frame=["xaf", "+tTitle+sSubtitle"])
with pygmt.config(FONT_LABEL="12p,Helvetica,black"):
    fig.colorbar(
        cmap="batlow",
        box="+c.25+gwhite+p1.5",
        position="JCR+o1.3/0c+n",
        frame=['x+lTemperature Residual: Observation minus Model'],
    )
fig.show()

produces

1 Like

Thank you @weiji14