Misplaced subplot labels? manually "nested" subplots

General question: Are there plans to support (a single level of) nested subplots at some point? I’m trying to show a pair of maps for each combination of two variables (in this case individual maps are landscape). I’ve managed to use subplot clearance (gmt set $row,$col -C...) to create this effect by increasing the vertical clearance below every other row and increasing the horizontal clearance between every column. When I do this, the subplot auto-labels don’t seem to be positioned correctly when I apply variable subplot clearances.

Here’s an example showing the unshifted auto-labels, script is below. It looks like the auto-labels are not shifted by the clearance, is this intentional? (auto-label placed in subplot “frame”, not the subplot “map”?) This happens if I use auto-labels (a, b, c, etc.) or if I set the auto-label text for each subplot. If this is intentional behavior for auto-labels, a note could be added to the documentation to suggest if subplot clearance is used, gmt text should be used for subplot labels instead of -A.

col_labels=(PGA 1.0s 5.0s)
row_labels=(BC BC E E)

gmt begin autolabel_unshifted png
  gmt set MAP_FRAME_TYPE plain MAP_FRAME_PEN thin,black FONT_TAG red
  # all columns have extra horizontal space on both sides (is this ignored if -Cn and -Cs are used in `subplot set`?)
  gmt subplot begin 4x3 -Fs4i/0 $RANGE $PROJ -Bwesn -Bf -A+jTL+o7p/7p -Cx$space
  for r in {0..3};
    # even rows have extra space above, odd rows have extra space  below
    if [[ $((${r} % 2)) -eq 0 ]];
      clearance="-Cn$space -Cs0"
      clearance="-Cn0 -Cs$space"
    for c in {0..2};
      #gmt subplot set $r,$c $clearance  #<- fully automatic auto-label
      gmt subplot set $r,$c $clearance -A"auto ${r},${c}"  #<- set auto-label text
      gmt text -Dj0.25c -F+cBR+f10p+t"text ${r},${c}"

      # plot column labels
      [[ "$r" == "0" ]] && gmt plot -T -B+t"${col_labels[$c]}"
      # plot row labels (todo: automate this vertical offset)
      [[ "$c" == "0" ]] && [[ $(($r % 2)) -eq 0 ]] && \
              gmt text -F+cLM+jTC+a90+f20p,Helvetica-Bold+t"SC  ${row_labels[$r]}" -N -D-1.3c/-3.5c

  gmt subplot end
gmt end show

Thank you,

I should have mentioned my first idea was to plot lines between the columns and every other rows to define the grid of map pairs. After subplot end, I got the figure dimensions with gmt mapproject -WjTR and used a bit of gmt math to get coordinates for the lines. I think the spacing with subplot clearance looks a bit better and is more precise than I managed to get with the lines.

Until I decide to try to see if I can add a recursive subplot begin call for any panel there is no such thing. We are aware of the need for this though. And the panel tags are as you say unaffected by clearance intentionally. I have added a sentence under -C to mention it does not affect clearance.

1 Like