Legend questions

Dear all,

I have few questions on building a legend in GMT. Please refer to the code and the corresponding map below:

#!/usr/bin/env bash
echo 103.7 1.2 > line.tmp
echo 112 5 >> line.tmp
gmt begin test png
gmt basemap -R95/125/-5/15 -JM30c -Bafg10
gmt grdimage @earth_relief_02m -I+a15+ne0.75
gmt coast -Gsnow2 -Slightcyan -t10 -Wthinnest -N1/1p,darkgrey -Bafg10 -LjLB+c-5+f+w500k+u+o0.8c
# Plot
gmt plot line.tmp --PS_LINE_CAP=round -W4,tan3,0_10:0
gmt image anchor.png -Dg103.7/1.2+w0.5c
echo 112 5 | gmt plot -Sc0.2c -Gblue -W1,black
# Build legend
gmt legend -DjRT+w8.5c/4.7c+o0c -F+p1p+gwhite <<- EOF
H 15p,Helvetica-Bold Some map
G 0.18c
S 0.5c c 0.3c blue 1p 1.4c Destination
G 0.2c
I anchor.png 0.5c LT Terminal
G 0.2c
S 0.5c - 0.3i - 1p,- 1.4c Shipping Route
G 0.2c
S 0.5c - 0.8c black 3p 1.4c Pipe Route
gmt end show
rm *tmp

My questions:

  1. I used raster “anchor” in the legend as a symbol, now I am having difficulties to move it slightly right to align with other symbols, and also label it as “Port”.
  2. I want to show in the legend the dotted line that I have plotted using --PS_LINE_CAP=round command. How can I add it to the legend (in my map I used dashed line labelled “Shipping route”)
  3. Non-legend-related question. I could cover a seabed relief (perhaps there is a better way) with monochrome colour but not the land. Could you please give me a hint how to plot topography (gridimage) using one colour?

I am sorry for the long question, I hope it is not too much.


Is the anchor raster a square image? Or is the anchor not centered in the image?
As for PS_LINE_CAP. We do not have (yet) the ability to change this on a per-line setting, so taht makes it difficult in legends. I have had some success plotting the legend twice, the second time with the PS_LINE_CAP setting and the 1st time using white for all the other entries.

That’s so smart! I have managed to plot PS_LINE_CAP on top of the legend and it looks great. Regarding the raster it is not a square image but I have decided to plot a simple circle instead. Thank you very much for your help, Professor Wessel!