Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

GMT_App_N_1.sh 2.0 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
  1. #!/usr/bin/env bash
  2. #
  3. # Makes the inset for Appendix N (custom symbols)
  4. #
  5. grep -v '^#' "${GMT_SOURCE_DIR}"/share/custom/gmt_custom_symbols.conf | $AWK '{print $1}' > tt.lis
  6. n=$(cat tt.lis | wc -l)
  7. # Because of text, the first page figure will contain less symbol rows than
  8. # subsequent pages.
  9. width=0.85
  10. n_cols=6
  11. n_rows=7
  12. n_rows_p1=7
  13. fs=9
  14. dy=0.15
  15. n_pages=$(gmt math -Q $n $n_cols DIV CEIL $n_rows_p1 SUB 0 MAX $n_rows DIV CEIL 1 ADD =)
  16. p=0
  17. s=0
  18. while [ $p -lt $n_pages ]; do
  19. p=$(expr $p + 1)
  20. if [ $p -eq 1 ]; then
  21. max_rows=$n_rows_p1
  22. else
  23. max_rows=$n_rows
  24. fi
  25. n_rows_to_go=$(gmt math -Q $n $s SUB $n_cols DIV CEIL $max_rows MIN =)
  26. H=$(gmt math -Q $n_rows_to_go 1 $dy ADD MUL =)
  27. rm -f tt.lines tt.symbols tt.text tt.bars
  28. touch tt.lines tt.symbols tt.text tt.bars
  29. c=0
  30. while [ $c -lt $n_cols ]; do
  31. c=$(expr $c + 1)
  32. cat << EOF >> tt.lines
  33. > vertical line
  34. $c 0
  35. $c $H
  36. EOF
  37. done
  38. r=0
  39. while [ $r -lt $n_rows_to_go ]; do # Loop over the rows that will fit this page
  40. r=$(expr $r + 1)
  41. yt=$(gmt math -Q $n_rows_to_go $r SUB 1.0 $dy ADD MUL 0.5 $dy MUL ADD =)
  42. ys=$(gmt math -Q $yt 1.0 $dy ADD 0.5 MUL ADD =)
  43. ysb=$(gmt math -Q $ys 0.5 SUB =)
  44. ytb=$(gmt math -Q $yt 0.5 $dy MUL SUB =)
  45. cat << EOF >> tt.lines
  46. > base of symbol line
  47. 0 $ysb
  48. $n_cols $ysb
  49. > base of text line
  50. 0 $ytb
  51. $n_cols $ytb
  52. EOF
  53. c=0
  54. while [ $c -lt $n_cols ] && [ $s -lt $n ]; do # Loop over this row, but watch for end of symbols
  55. c=$(expr $c + 1)
  56. s=$(expr $s + 1)
  57. x=$(gmt math -Q $c 1 SUB 0.5 ADD =)
  58. symbol=$(sed -n ${s}p tt.lis)
  59. echo "$x $ys k${symbol}" >> tt.symbols
  60. name=$(echo $symbol | tr 'a-z' 'A-Z')
  61. echo "$x $yt $name" >> tt.text
  62. echo "$x $yt $width $dy" >> tt.bars
  63. done
  64. done
  65. gmt begin GMT_App_N_$p
  66. gmt set GMT_THEME cookbook
  67. gmt plot -R0/$n_cols/0/$H -Jx${width}i tt.lines -Wthick -B0
  68. gmt plot -S${width}i -W0.5p tt.symbols -Ggray
  69. gmt plot -Sri -Gblack tt.bars
  70. # Shorten the spelling of QR_TRANSPARENT to QR_TRANSP to fit the figure
  71. sed -e 's/TRANSPARENT/TRANSP/' < tt.text | gmt text -F+f${fs}p,white
  72. gmt end show
  73. done
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...