gmt icon indicating copy to clipboard operation
gmt copied to clipboard

-Xw+1c fails after gmt inset

Open Esteban82 opened this issue 2 years ago • 3 comments

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

Esteban82 avatar Jul 12 '22 13:07 Esteban82

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.

seisman avatar Jul 12 '22 13:07 seisman

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

Esteban82 avatar Jul 12 '22 14:07 Esteban82

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.

PaulWessel avatar Jul 12 '22 14:07 PaulWessel