Hi Yvonne,
Thanks for your reply. Let me clarify, as this might be helpful for anyone who encounters the same issue:
I defined the frame type as “inside,” following your example, and it works fine. However, the problem arises when you add other plotting elements (fig.grdimage etc. )—the figure overlaps the frame annotations, causing the annotations to be hidden underneath, making the coordinates invisible. To solve this, I re-defined the fig.basemap
at the end of the code like this:
fig = pygmt.Figure()
Configuration for the ‘current figure’.
pygmt.config(MAP_FRAME_TYPE=“inside”)
fig.basemap(region=plot_region, projection=“X10c/12c”, frame=[“xa1f1”,“ya1f1”, “WSen”])
Create a color palette with blue for water and gray for land
pygmt.makecpt(cmap=“gray”, series=[-22000, 9000, 3000], continuous=True)
Add DEM relief background using the locally saved file
fig.grdimage(grid=dem,cmap=True,region=region,shading=True,frame=False)
fig.basemap(region=plot_region, projection=“X10c/12c”, frame=[“xa1f1”,“ya1f1”, “WSen”])
You can directly define the basemap at the bottom but it would be a problem for defining the region, and subplotting, therefore I re-define double times and the problem solved in this way. If there is more easy and professional way happy to try that as well!
Cheers,