GenericMappingTools / gmt

The Generic Mapping Tools
https://www.generic-mapping-tools.org
Other
855 stars 357 forks source link

-Xw+1c fails after gmt inset #6879

Open Esteban82 opened 2 years ago

Esteban82 commented 2 years ago

When I use the a command with -Xw after gmt inset, the second plot is NOT properly displaced.

gmt begin BUG_Inset png
       gmt coast -JM10c -RAR.V -Baf -W
    gmt inset begin -DjTL+w2c+o-0.08c
        gmt coast -Rg -JG-67/-54/? -Da -Swhite -B0 -W1/faint
    gmt inset end
    gmt basemap -Baf -Xw+1c
gmt end show

Output with gmt inset commands:

BUG_Inset

Output without gmt inset commands: BUG_Inset

seisman commented 2 years ago

I think that's expected because w is the width of the previous element. So in your case, w is the width of the inset box.

Esteban82 commented 2 years ago

So, is this how is supposed to work?

The docs says "For instance, to move the origin up 2 cm beyond the height of the previous plot, use -Yh+2c. " But If I use -DJTR then w equals the width of the inset but the X and Y are related to the main plot. So with the following example, I got a 4 cm offset (w+1c) but offset to the main plot (instead of the inset).

gmt begin BUG_Inset png
    gmt basemap -JM10c -RAR.V -Baf 
    gmt inset begin -DJTR+w3c+o-0.08c
        gmt coast -Rg -JG-67/-54/? -Da -Swhite -B0 -W1/faint
    gmt inset end
    gmt basemap -Baf -Xw+1c
gmt end show

BUG_Inset

PaulWessel commented 2 years ago

I am pretty sure the w and h in -X -Y was meant to handle subplots only. So after doing a subplot one could move the full size of the plot even though you never specified what that was (say, via -Fs instead). I suspect also that the inset messes with things though, so it may be a bug regardless.