# Plot a schmidt stereonet

**URL:** <https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067>\
**Category:** Q&A\
**Created:** [July 23, 2025, 2:03am UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067 "2025-07-23T02:03:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rom1](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/rom1/32/4955_2.png) [@Rom1](https://forum.generic-mapping-tools.org/u/Rom1)\
**Post date:** [July 23, 2025, 2:03am UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/1 "2025-07-23T02:03:12Z")

</div>

Hi everyone,

I have a 2-column file containing azimuth and plunge values, representing the poles to fault planes. I would like to plot them on a Schmidt stereonet (equal-area projection), but I can’t get it to work — the points appear outside the stereonet circle.

Here is my current script:

```auto
gmt begin "STEREO_${type}" png
    gmt basemap -R0/360/0/90 -JA0/0/10 -Ba20g10
    gmt plot STEREO_POLE_${type}.txt -Sc0.1 -Gred
gmt end

```

With the first line of `STEREO_POLE_${type}.txt` being: `124 25`

Any help or advice would be greatly appreciated.

Cheers,  
Romain

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [July 23, 2025, 3:34pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/2 "2025-07-23T15:34:51Z")

</div>

I think I could help you but I don’t remind exactly how the Schmidt stereonet works. Could you show me what is the expected output and what is the meaning of the input values.

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [July 23, 2025, 5:12pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/3 "2025-07-23T17:12:03Z")

</div>

I think this is your answer.  
First, I use a `-JA` command to plot only the stereonet gridlines.  
Then, in the second line, I switch to the `-JP` option to plot the polar data. For this, the azimuth is used directly, but the plunge needs to be converted to its complementary angle (i.e., 90° – plunge), which I do using `awk`. Please let me know if my script works for you.

```auto
#Create data file
cat > data << EOF
124 25
EOF

width=10c # Set width of the stereonet

gmt begin stereonet png
    gmt basemap -Rd -JA0/0/$width -Bg15 # Plot stereonet grid
    awk '{print $1,90-$2}' data | gmt plot -JP$width+a -Sc0.3c -Gred 
gmt end

```

 ![Polar_Stereonet](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/1/1d098ad66356be26c8bfb92547fb71d2972cf6b5.png)

---

<div class="post-metadata">

**Author:** ![Rom1](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/rom1/32/4955_2.png) [@Rom1](https://forum.generic-mapping-tools.org/u/Rom1)\
**Post date:** [July 23, 2025, 10:31pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/4 "2025-07-23T22:31:31Z")

</div>

It works ! I haven’t think of -JP !  
Thank you !  
By the way, looking at the doc for -JP you can directly use `-JP$width+a+fe` to flip the radial direction to point inwards and it avoid the use of awk

---

<div class="post-metadata">

**Author:** ![Rom1](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/rom1/32/4955_2.png) [@Rom1](https://forum.generic-mapping-tools.org/u/Rom1)\
**Post date:** [July 23, 2025, 10:46pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/5 "2025-07-23T22:46:46Z")

</div>

Sorry but after few try I don’t thinks it works  
Imagine a plane with a strike of 180 and a dip of 60, the pole has a trend of 90 and a plunge of 30.  
So we use :

```auto
gmt begin "STEREO_${type}" png
    gmt basemap -R0/360/0/90 -JA0/0/10 -Bg10
    echo "90 30" | gmt plot -JP10+a+fe -Sc0.1 -Gblue -Ba20
  gmt end

```

Here is the result (blue dot) but it is supposed to be were the red dot is

 ![STEREO_DATA](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/a/aa84580308243c8f880755609f3437de8a2155c9.png)

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [July 24, 2025, 1:12pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/6 "2025-07-24T13:12:48Z")

</div>

Uhh, I see. Maybe it’s not a a good idea to change the projection to -JP.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [July 24, 2025, 6:04pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/7 "2025-07-24T18:04:27Z")

</div>

One cannot mix projections (-JP & -JA) and expect that points are where expected.

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [July 24, 2025, 10:03pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/8 "2025-07-24T22:03:24Z")

</div>

Yes, I realize that. We need to find a way to plot the data in the correct position. I think that instead of using `-JP`, we should use `-JA0/-90`.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [July 24, 2025, 10:52pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/9 "2025-07-24T22:52:45Z")

</div>

No, the Schmidt chart is Lambert with center at 0,0 (see [CookBook](https://docs.generic-mapping-tools.org/dev/reference/map-projections.html#hemisphere-map)), but it is a Lambert proj nevertheless and expects coordinates as lon,lat. Azimuth and Dip should be converted to the lon,lat that it expects.

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [July 25, 2025, 1:23am UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/10 "2025-07-25T01:23:04Z")

</div>

Yes, I meant that with` -JA0/-90` you could plot the data almost without convertion. I only had to add a negative sign to the plunge.

```auto
cat > data << EOF
# Azimuth Plunge
90 -30
180 -45
270 -60
0 -15
30 -45
EOF
width=10c
gmt begin stereonet png
    gmt basemap -Rd -JA0/0/$width -Bg15
    gmt plot data -JA0/-90/$width -Sc0.3c -Gred
gmt end

```

 ![Polar_Stereonet](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/5/561ed470c7d4a2c3f3105c63a06ced7688a812bb.png)

I think this is ok, except for the value 30 -45 which should be over the gridlines I think.

Altought, I tried the following and the value is over the gridlines.

```auto
gmt begin stereonet png
    #gmt basemap -Rd -JA0/0/$width -Bg15
    gmt plot data -Rd -JA0/-90/$width -Sc0.3c -Gred -Bg15a45
gmt end

```

 ![Polar_Stereonet](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/0/0db0a1a71347e4f9881339b16b9e345703c3eaa8.png)

---

<div class="post-metadata">

**Author:** ![Rom1](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/rom1/32/4955_2.png) [@Rom1](https://forum.generic-mapping-tools.org/u/Rom1)\
**Post date:** [July 25, 2025, 5:17am UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/11 "2025-07-25T05:17:49Z")

</div>

Hi everyone,

Thanks a lot for your help!

Using `-JA0/-90` might do the trick for points but I’m not sure if it’s possible to use it to plot planes

I finally managed to plot a stereonet with both fault planes and poles. It was quite tricky, and I couldn’t find clear answers anywhere (I guess I might be the only one stubborn enough to insist on doing this with GMT!).

As Joaquim pointed out, it’s necessary to convert strike and dip values to longitude and latitude. I wasn’t familiar with this kind of transformation, so it took me a while to figure it out. I don’t know if there’s a more straightforward method, but here’s how I did it:

1. Assume the **dip** is the _longitude_ and set _latitude_ to 0.
2. Convert these spherical coordinates (_lat_/_lon_) to 3D Cartesian coordinates (_x_/_y_/_z_).
3. Apply a 3D rotation matrix to rotate the points according to the **strike**. (Be very careful with angle conventions _e.g._, **strike** is measured clockwise from north, while Cartesian angles are typically counterclockwise from the x-axis. And angle units degree et radian)
4. Convert the rotated Cartesian coordinates back to spherical (_lat_/_lon_).

If there’s a simpler or more elegant way to do this, feel free to share!

**If any GMT developer happens to read this** a `gmt stereonet` command in a futur version would totally make the day of every structural geologist out there (myself included)! 😂

Attached below is my script and the resulting plot.

```auto
gmt begin "STEREO" png
    gmt basemap -R0/360/-90/90 -JA0/0/10 -Bpg2 -Bsg20 --MAP_GRID_PEN_PRIMARY=0,gray --MAP_GRID_PEN_SECONDARY=0,black
    
    # Create the points along the fault plane and plot it
    awk '
      function asin(x) { return atan2(x, sqrt(1-x*x)) }
      function acos(x) { return atan2(sqrt(1-x*x), x) }
      function atan(x) { return atan2(x,1) } 
      {
        pi = atan2(0,-1)
        dip = -(90-$3) * (pi/180)
        strike = (180+$2) * (pi/180)
        print ">"
        i = 0
        for (val = -90; val <= 90; val++) {
          lat[i] = val * (pi/180)
          lon[i] = dip
          i++
        }

        for (j = 0; j < i; j++) {
          x = cos(lat[j]) * cos(lon[j])
          y = cos(lat[j]) * sin(lon[j])
          z = sin(lat[j])

          yrot = y * cos(strike) + z * sin(strike)
          zrot = -y * sin(strike) + z * cos(strike)

          r = sqrt( x **2 + yrot** 2 + zrot**2)
          latrot = asin( zrot / r ) * (180/pi)
          lonrot = atan2( yrot , x ) * (180/pi)

        print lonrot, latrot 
      }
      delete lat
      delete lon
    }' data | gmt plot -W0.5,red -l"fault plane"
    
    # Calculation of the pole and plot
    awk '
      function asin(x) { return atan2(x, sqrt(1-x*x)) }
      function acos(x) { return atan2(sqrt(1-x*x), x) }
      function atan(x) { return atan2(x,1) } 
      {
        pi = atan2(0,-1)
        dip = (-$3) * (pi/180)
        strike = ($2) * (pi/180)

        x = cos(dip)
        y = sin(dip)
        z = 0

        yrot = y * cos(strike) + z * sin(strike)
        zrot = -y * sin(strike) + z * cos(strike)

        r = sqrt( x **2 + yrot** 2 + zrot**2)
        lat = asin( zrot / r ) * (180/pi)
        lon = atan2( yrot , x ) * (180/pi)

        print lon, lat
    }' data | gmt plot -Sx0.1 -l"pole"
    
    gmt basemap -R0/360/-90/90 -JP10+a -Ba15
    gmt legend -DjBR+w3+jBR -F+gwhite+p0,black
  gmt end

```

 ![STEREO_DATA](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/a/ab340c6696d2e6e52f0a36072ef80fd3b9d6cad7.png)

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [July 25, 2025, 12:35pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/12 "2025-07-25T12:35:58Z")

</div>

Thanks, @Rom1 — it looks great!  
I tried running it, but I couldn’t get the data to plot. Would you mind sharing what your input file looks like?

---

<div class="post-metadata">

**Author:** ![Rom1](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/rom1/32/4955_2.png) [@Rom1](https://forum.generic-mapping-tools.org/u/Rom1)\
**Post date:** [July 26, 2025, 1:10am UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/13 "2025-07-26T01:10:56Z")

</div>

My input file was a 3 column txt files: fault\_name strike dip. You can try with this :

> FAULT\_1 90 30  
> FAULT\_2 180 45  
> FAULT\_3 270 60  
> FAULT\_4 0 15  
> FAULT\_5 30 45  
> FAULT\_6 120 48  
> FAULT\_7 225 27  
> FAULT\_8 350 80

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [July 26, 2025, 1:49am UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/14 "2025-07-26T01:49:59Z")

</div>

Thanks. It works!

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [July 29, 2025, 1:58pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/15 "2025-07-29T13:58:20Z")

</div>

@Rom1 Thanks for your example. Based on it I made this GMT.jl [stereonet](https://github.com/GenericMappingTools/GMT.jl/blob/master/src/plot.jl#L2245) function that can be used like in

[https://www.generic-mapping-tools.org/GMTjl\_doc/documentation/utilities/stereonet/index.html#stereonet](https://www.generic-mapping-tools.org/GMTjl_doc/documentation/utilities/stereonet/index.html#stereonet)

It should not be very difficult to write a pure GMT function to do this. Volunteers?

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [July 29, 2025, 7:19pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/16 "2025-07-29T19:19:55Z")

</div>

> [@Joaquim](#):
>
> Volunteers?

I would like to try.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [July 29, 2025, 7:40pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/17 "2025-07-29T19:40:26Z")

</div>

Cool. But next two weeks I’ll be at the Namibe desert where I don’t expect to have much internet (and no computer either ofc).

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [July 30, 2025, 7:15am UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/18 "2025-07-30T07:15:26Z")

</div>

> I’ll be at the Namibe desert

Remember to bring plenty of water and emergency bacalao.

---

<div class="post-metadata">

**Author:** ![Rom1](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/rom1/32/4955_2.png) [@Rom1](https://forum.generic-mapping-tools.org/u/Rom1)\
**Post date:** [November 10, 2025, 9:48pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/19 "2025-11-10T21:48:57Z")

</div>

Hey guys!  
Hope you’re all doing well!  
Just wondering if there’s been any progress on the attempts to create a GMT stereonet function directly in pure GMT?

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [November 11, 2025, 6:55pm UTC](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067/20 "2025-11-11T18:55:05Z")

</div>

Hi,

I’m afraid no one is really tackling that problem.

[Next page](https://forum.generic-mapping-tools.org/t/plot-a-schmidt-stereonet/6067.md?page=2)
