Proper usage of -S~

I’m trying to get plot -S~ to work. I’m struggling on how to pass desired the symbol. According to the documentation for -S~

+s<symbol><size>

Specifies the code and size of the decorative symbol.

I was unable to find anything on what the +s option expects exactly. I assumed it to be similar to -Sk and tried

-S~d30p:+striangle10p

without luck:

plot [WARNING]: riangle10 not a valid number and may not be decoded properly.

That lead me to assume that only the first character after the +s is parsed as symbol. Trying

-S~d30p:+st10p

didn’t throw an error but plotted only the line. No symbols to be seen. Another try was the custom symbol syntax:

-S~d30p:+sktriangle/10p

which didn’t work as well and I get some warnings and a line:

plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [WARNING]: triangle/10 not a valid number and may not be decoded properly.
plot [ERROR]: Unrecognized symbol code (107 = 'k') passed to gmt_draw_custom_symbol

I get the feeling I’m missing something. Can somebody please nudge me in the right direction on the proper usage of -S~?

Here is the code I’m experimenting with:

cat > path1.txt << END
 1.5  0.9
 0.5  1.8
-0.5  1.6
-1.5  0.9
END

gmt begin symbol_line
  gmt basemap -R-2/2/-2/2 -JM6i -Bafg1
  gmt plot path1.txt -S~d30p:+sktriangle/10p -W1p,black
gmt end show

Thank you and all the best,
Kristof

See the test/psxy/decoratedlines.sh script for some examples.

Thank you @pwessel for the hint. I found my problem – by default no pen or fill is used on the symbol.

A pen and/or fill must be defined otherwise the symbol won’t be shown. I have expected that it is plotted with default values for pen and fill similar to -Sf and others.

-S~d30p:+st10p+gred
              ~~~~~

works. But I have two questions:

  • Why is the symbol angled? According to the docs default should be line parallel? The result doesn’t look line parallel to me. Maybe I’m not understanding it correctly.
  • Any way to use custom symbols? Unleash the power of custom symbols … on lines!

cat > path1.txt << END
-1.5 -1.5
 1.5  1.5
END

gmt begin symbol_line
  gmt basemap -R-2/2/-2/2 -JM6i -Bafg1
  gmt plot path1.txt -S~d50p:+st50p+gred -W1p,black
gmt end show

Not sure, will look as time allows.

Fixed in GitHub. Now with default pen if nothing specified. Not sure about custom symbols yet.

@pwessel that works like a charm – look what I can do now thanks to your efforts!

Thank you very much!

(Done with 6.1.0_58d597c_2020.04.02)

@pwessel if you are not sure why custom symbols would be beneficial have a look at nautical charts or NOAA Chart No 1 Part N. They have a great variety of different lines with symbols (anchors, ducks, divers, fishes, etc). I tried to build two easier ones with the given possibilities so you get an idea:

cat > path1.txt << END
-1.5 -0.5
-0.5  1.7
 1.5  1.5
END

cat > path2.txt << END
-1.5 -1
 0    1
 1.5  1.2
END

gmt begin symbol_line
  gmt basemap -R-2/2/-2/2 -JM6i -Bafg1
  # no entry
  gmt plot path1.txt -W0p,white+o158p/0 -Sf+192p/28p+c -Gred
  gmt plot path1.txt -W0p,white+o158p/0 -Sf+192p/6p+f+p17p,white
  gmt plot path1.txt -W4p,black,28_20_28_20_28_68
  # caution
  gmt plot path2.txt -W4p,black,8_4
  gmt plot path2.txt -W0p,white -S~d80p:+st50p+gblack+p3p,white -Gblack
  gmt plot path2.txt -W0p,white -S~d80p:+st28p+gyellow
  gmt plot path2.txt -W0p,white+o80p/0 -Sf+80p/10p+f+p3p,black
  gmt plot path2.txt -W0p,white+o80p/0 -Sf+80p/4p+f+p4p,yellow
  gmt plot path2.txt -W0p,white+o80p/0 -Sf+80p/1p+f+p3p,black
  gmt plot path2.txt -W0p,white+o80p/0 -Sf+80p/16p+f+p3p,black+l
gmt end show

Not a question if useful, just a question if possible. But I am past that now and am close to wrap up the implementation.