The origin shifts depending on the z-plane

Thanks to @Esteban82 comment, I’m testing a few things in 3D mapping, and I found a very insteresting behaviour of PyGMT which I can’t explain (see the original post on Some 3D maps using PyGMT and the new IBCSO data).

Check the code here:

fig = pygmt.Figure()
peninsula = [-70,-50,-71,-60]
fig.basemap(region=peninsula+[-5500,3000],
projection=‘L-60/-65/-72/-60/15c’,
perspective=[-35,35,-1000],
frame = [“xa10f1”,“ya5f1”, “z2000+lmeters”, “WseNZ”],
zsize=‘5c’)
fig.show()

When you change the perspective to ‘perspective=[-35,35,-5500]’ (following https://docs.generic-mapping-tools.org/latest/gmt.html#perspective-full) you get the image:

Otherwise, if you change the z-plane to higher (say -1000), the map origin “shifts”:

@Esteban82 noted also that the z-axis is not aligned to the lower left corner (why ?)

Any clues ?

André, in these cases it is simpler if you post the plain GMT command. For example here I can’t really understand what python does with the above operation where a 4 and a 2 elements vector are added. This should be a undefined (error) operation, but apparently it isn’t.

And quite likely the troubles resurfaced in https://github.com/GenericMappingTools/gmt/issues/6741 are striking here too.

Ok, first thing first … The focus is PyGMT but I use the same colab to reproduce the first error (note the problem is not pythonic). Doing in plain GMT:

gmt begin test png
gmt psbasemap -R-70/-50/-71/-60/-5500/3000 -JL-60/-65/-72/-60/15c -JZ5c -p-35/35 -B -Bza2000f1000 -BWseNZ 
gmt end

The result is:

Why the vertical z-axis is not exactly on the corner of 50°W/60°S ? Is it because the projection ?

Now, abouth the shifting:

gmt begin test png
gmt psbasemap -R-70/-50/-71/-60/-5500/3000 -JL-60/-65/-72/-60/15c -JZ5c -p-35/35/-5500 -B -Bza2000f1000 -BWseNZ
gmt end

produces this:

and the code (note the change in z-level to -1000):

gmt begin test png
gmt psbasemap -R-70/-50/-71/-60/-5500/3000 -JL-60/-65/-72/-60/15c -JZ5c -p-35/35/-1000 -B -Bza2000f1000 -BWseNZ
gmt end

produces this long shift to right:

Why ?

hummm…got something here. @Joaquim, looking you reference here https://github.com/GenericMappingTools/gmt/issues/6741, I tried a “+b” in -BWseNZ+b and voilà …

The answer as to why the z axis is shifted is the metric combination (z) with the projection (-JL) “deforms” the geographic plane over the bounding box created in figure . So the axis will certainly appear to be offset from the point of the figure.

:wink: