Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add splines figure and script #6656

Merged
merged 10 commits into from
May 6, 2022
Next Next commit
Add files via upload
This PR is related to issue #6643. It add a new figure and script to better explain the splines in the docs.

Here I add the script. Let me know if it is ok. 

In what part of the docs should the figure go? At the end of -F argument?
  • Loading branch information
Esteban82 committed May 2, 2022
commit 911c223349c7038e298cc41838083fdef55f2ad9
24 changes: 24 additions & 0 deletions doc/scripts/GMT_splines.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
#
# Show all splines and their derivatives for a basic data set
cat << EOF > t.txt
0 0
1 1
2 1.5
3 1.25
4 1.5
4.5 3
5 2
6 2.5
EOF
# Splines
gmt begin doc_splines png
gmt basemap -R-0.1/6.1/-0.1/3.1 -JX15c/6c -Baf+l"u" -By+l"u(x)" -BWSne
gmt sample1d t.txt -T0.01 -Fc | gmt plot -W1p -l"Cubic spline (-Fc)"
gmt sample1d t.txt -T0.01 -Fs1 | gmt plot -W1p,orange -l"Smooth cubic spline (-Fs1)"
gmt sample1d t.txt -T0.01 -Fl | gmt plot -W1p,blue -l"Linear spline (-Fl)"
gmt sample1d t.txt -T0.01 -Fa | gmt plot -W1p,red -l"Akima spline (-Fa)"
gmt sample1d t.txt -T0.01 -Fn | gmt plot -W1p,darkgreen -l"Nearest neighbor (-Fn)"
gmt plot t.txt -Sc0.25c -Gred -Wthin -l"Data"
gmt legend -DjTL+w4.9c+o0.2c -F+p1p+gwhite+s
gmt end