Adding text outside the figure

Adding text outside the figure

Hello everyone,

Can pygmt add text to the outside of a graph?

I have the following code so far:

import pygmt

fig = pygmt.Figure()

with pygmt.config(FONT_TITLE="18p,5", MAP_TITLE_OFFSET="-12p", MAP_FRAME_TYPE="plain"):
    with fig.subplot(nrows=1, ncols=2, figsize=("42c", "28c"), margins=["0.1c", "0.1c"]):
        with fig.set_panel(panel=[0, 0]):
            pygmt.makecpt(cmap="jet", series=[255, 295, 40 / 64])
            fig.grdimage(grid=fr'276_ESTARFM.tif', frame=["lbtr+tESTARFM"], cmap=True)

        with fig.set_panel(panel=[0, 1]):
            pygmt.makecpt(cmap="jet", series=[255, 295, 40 / 64])
            fig.grdimage(grid=fr'276_RFCDF.tif', frame=["lbtr+tRFCDF"], cmap=True)
            with pygmt.config(FONT="12p,4"):
                fig.colorbar(cmap=True, position="JMR+w5c/0.5c", frame=["a", "y+lLST(K)"])

fig.show()

I’m trying to add text to the left side of the first subfigure, and pygmt.Figure.test() only seems to be able to add text to the inside of the figure.

The final result I’m trying to get is shown below:

Use no_clip=True when calling Figure.text().

2 Likes

Hello @seisman, it works!!!, thank you!!, stay safe and best regards.

1 Like