# How to plot a cross-section (length 300 km) passing through a fixed point with a 30\_degree strike

**URL:** <https://forum.generic-mapping-tools.org/t/how-to-plot-a-cross-section-length-300-km-passing-through-a-fixed-point-with-a-30-degree-strike/2617>\
**Category:** Q&A\
**Created:** [February 11, 2022, 5:55am UTC](https://forum.generic-mapping-tools.org/t/how-to-plot-a-cross-section-length-300-km-passing-through-a-fixed-point-with-a-30-degree-strike/2617 "2022-02-11T05:55:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adnan](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@Adnan](https://forum.generic-mapping-tools.org/u/Adnan)\
**Post date:** [February 11, 2022, 5:55am UTC](https://forum.generic-mapping-tools.org/t/how-to-plot-a-cross-section-length-300-km-passing-through-a-fixed-point-with-a-30-degree-strike/2617/1 "2022-02-11T05:55:59Z")

</div>

Hi Everyone,  
I require to plot a cross-section line (300 km) passing through a fixed point having a strike 30\_degree NW.  
Here is my script (G.M.T 6.3.0)

```auto
 #!/bin/sh

gmt begin TEST png

# constructing the frame
gmt basemap -JM10c -R114/131/-14/-5 -BWeSn -Bxa5f1 -Bya2f1
# creating a colormap with customized boundaries
gmt makecpt -Crelief -T-6000/6000/200 -D -Z -H > elevation.cpt
# plotting the topography data, which can be remotely obtained from gmt database using the @earth_relief_??? option
gmt grdimage @earth_relief_01m -Celevation.cpt -I+
# plotting the coastline data
gmt coast -W0.5p,black -Da -LjTL+c115E/6S+w300k+f+l+o0.25c/0.45c --MAP_FRAME_PEN=faint --FONT=6.5p, --MAP_LABEL_OFFSET=-3p
# inset a global figure with the specify boundary
gmt inset begin -Dn1/0+jBR+w2.5c
gmt coast -Rg -JG123/-10/90/? -B -Swhite -A5000 -Ggray -W0.2p,black -Da --MAP_FRAME_PEN=0.2p
echo -e "\n114 -14\n131 -14\n131 -5\n114 -5\n114 -14" | gmt plot -W0.5p,red
gmt inset end
# plotting the trench data using given data file
gmt plot java_trench.txt -W1.0p,red
gmt plot java_trench.txt -Wthinner,red -Sf1.c/0.13c+l+t+o0.2c -Gred
# inserting text
echo '116 -12 Java trench' | gmt text -F+f8p,white
# extracting stations locations from data files
awk 'NR>1 {print $5,$6}' GE_3_stations.txt | gmt plot -Si6p -W0.1p,black -Gred

awk 'NR>1 {print $5,$6,$2}' GE_3_stations.txt | gmt text -F+f4p,red

awk -F"|" 'NR>3 {print $6,$5}' YS_30_stations.txt | gmt plot -Si6p -W0.1p,black -Gyellow
awk -F"|" 'NR>3 {print $6,$5,$2}' YS_30_stations.txt | gmt text -F+f3p,black

# creating colorbar legend
gmt colorbar -Dn1/0+o0.5c/0c+jBL+w5.5c -Bxa3000 -By+l"Topo (m)" -Celevation.cpt

echo '120 -6 Eurasian Plate' | gmt text -F+f8p,red
echo '125 -13 Australian Plate' | gmt text -F+f8p,red

gmt project -C120e/8S -A30 -G1 -L-180/180 -Q > great_circle.txt

gmt plot great_circle.txt -W1.0p,red

gmt end show

rm elevation.cpt

```
