pyGMT cutting off edges of figure

Good morning,

I’ve modified the pyGMT “Advanced Subplot” example here, but the figure ends up with the axis and/or tick labels cutoff. No amount of shifting the subplots around seems to be able to resolve this.

Here’s a minimal working example:

import pygmt
fig = pygmt.Figure()

with fig.subplot(nrows=1, ncols=1, figsize=("5i", "6i"), autolabel="a)"):
    fig.basemap(region=[-122.8, -122.2, 47.8, 48.5],projection='M3.5i')
    
fig.shift_origin(xshift="4.3i",yshift="0.25i")

with fig.subplot(nrows=2, ncols=1, figsize=("3i", "6i"), autolabel="b)"):
    fig.basemap(region=[0, 60,0, 1], projection="X2.5i")
    fig.basemap(region=[0, 60,0, 1], projection="X2.5i", panel=[1, 0])
fig.savefig('problem.png')
fig.show()

My issue seems similar to this question, but the resolution to that was that the problem would be fixed in an upcoming release that has already occurred (?).

Thanks for your help.

Brad

Have you tried to update ?

Could you show the output of python -c "import pygmt; pygmt.show_versions()"? Especially which gs version you’re using?

I think some old gs versions are buggy and may cause incorrect cropping at edges.

BTW, in subplot mode, you need to use projection="M?" instead of projection="M3.5i" to let GMT determine the figure width. Otherwise, your data points will be incorrectly placed.