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 https://flint.soest.hawaii.edu/t/some-3d-maps-using-pygmt-and-the-new-ibcso-data/3017).

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 gmt — GMT 6.5.0 documentation) 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 Some issues with 3D plots · Issue #6741 · GenericMappingTools/gmt · GitHub, 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: