gmt icon indicating copy to clipboard operation
gmt copied to clipboard

3-D perspective views in subplots

Open PaulWessel opened this issue 3 years ago • 2 comments

Subplot expects information about panel size via -S. however, for 3-D perspective views it appears as these have little effect. This is related to the earlier fix #6516 for placement of colorbars. For instance, here is a 2x1 plot:

view

It is similar: subplot uses the -R -J of the equivalent 2-D plot (-R-32/52/-32/32 -Jx0.2c) and that gives a 16.8 x 16.8 cm square plot. That is why there is so much white space. To confirm I can run the same script with -p180/90 and get

view3

So here we see that spacing is honored but it is always calculated as if a 2-D flat plot. I think what we want is the following:

When a perspective plot is desired for a panel, the fitting of the plot inside the given space needs a special check: We must compute the 3-D box and its 2-D coordinates and use that bounding box as the equivalent 2-D plot region. We can now shrink that to fit the panel. Then, that shrink factor can be applied to the 3-D projection as well.

In my case, I would have to select a -Fs with a short height. Now, we can debate if one should be able to say

gmt subplot begin -Rw/e/s/n -JM15c -p130/20 -Fs15c/0

and have subplot compute that height for us. I think that would be desirable. Thoughts?

PaulWessel avatar Apr 04 '22 16:04 PaulWessel

Wouldn't gmt subplot begin -Rw/e/s/n -JM15c -p130/20 -Fs15c/? or gmt subplot begin -Rw/e/s/n -JM15c -p130/20 -Fs15c/ be more inline with auto-computation elsewhere?

maxrjones avatar Apr 04 '22 16:04 maxrjones

I think we only use ? inside subplots or inside insets, not "outside", i.e., before we create them. Contrast with -JX15c/0 which will compute the y based on xscale and y-range. But perhaps these are really the same things.

PaulWessel avatar Apr 04 '22 16:04 PaulWessel