# Stereonet diagram

**URL:** <https://discourse.julialang.org/t/stereonet-diagram/73121>\
**Category:** Visualization\
**Tags:** pycall, geo, gmt\
**Created:** [December 15, 2021, 8:03am UTC](https://discourse.julialang.org/t/stereonet-diagram/73121 "2021-12-15T08:03:13Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gravlax](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Post date:** [December 15, 2021, 8:03am UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/1 "2021-12-15T08:03:13Z")

</div>

Dear all,  
I was wondering if any of you have came across a package that could be use for making stereonets (stereographic projections on a Wulff/Schmidt nets), e.g.:

> **[pi diagram Archives](https://www.geological-digressions.com/tag/pi-diagram/)**

I’ve not found any examples of such diagram construction using Julia but I may have simply missed it…  
Cheers and thanks!

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [December 15, 2021, 12:42pm UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/2 "2021-12-15T12:42:08Z")

</div>

I’m not aware of such specific Julia package, but GMT.jl would be the first place to look at, as it provides both [Schmidt and Wulff projections](https://docs.generic-mapping-tools.org/dev/cookbook/map-projections.html#hemisphere-map).

If needed, the data processing could be done in Julia and the display could call a stereonet package in Python:

```julia
# In Windows Powershell do: pip install mplstereonet
using PyCall
using PyPlot
mplstereonet = pyimport("mplstereonet")

fig = plt.figure()
ax = fig.add_subplot(111, projection="stereonet")

strike, dip = 315, 30
ax.plane(strike, dip, "g-", linewidth=2)
ax.pole(strike, dip, "g^", markersize=18)
ax.rake(strike, dip, -25)
ax.grid()
plt.show()

```

![PyCall_mplstereonet](https://global.discourse-cdn.com/julialang/original/3X/6/a/6a38713e06aebca773f9075766742bdf97d3e1c7.png)

---

<div class="post-metadata">

**Author:** ![Gravlax](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Post date:** [December 15, 2021, 1:29pm UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/3 "2021-12-15T13:29:50Z")

</div>

Thanks a lot, that looks nice.  
I was looking for a pure Julia solution initially.  
Besides notebook working fine. The combination Julia/Python has always been problematic for me (working on macs). And somehow GMT.jl also fails on my computer:  
`ERROR: LoadError: InitError: could not load library "/Users/imac/.julia/conda/3/lib/libgdal.29.dylib" dlopen(/Users/imac/.julia/conda/3/lib/libgdal.29.dylib, 1): Library not loaded: @rpath/libexpat.1.dylib Referenced from: /Users/imac/.julia/conda/3/lib/libgdal.29.dylib Reason: Incompatible library version: libgdal.29.dylib requires version 10.0.0 or later, but libexpat.1.6.12.dylib provides version 8.0.0`

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [December 15, 2021, 2:06pm UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/4 "2021-12-15T14:06:23Z")

</div>

> [@Gravlax](#):
>
> And somehow GMT.jl also fails on my computer:

Take a look at this [GMT on Mac post](https://discourse.julialang.org/t/errors-associated-with-using-gmt/70393/18).

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [December 15, 2021, 6:51pm UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/5 "2021-12-15T18:51:25Z")

</div>

That error means you are using the GMT bundle for Mac and unfortunately we don’t understand what Xcode does that sticks those `@rpath/...` in the library dependencies such that it only works for the bundle but render that installation useless when calling the libs from external programs like Julia does. Some two weeks ago a user had the same trouble and solved it by removing the bundle and installing GMT via `homebrew`. Not having any GMT installed should also trigger its installation via Conda, but like mentioned in the GMT.jl install instructions that implies an absurd amount of disk space (blame Conda).

Now, regarding the question, also here some shits is happening. This should work but apparently a bug is interfering (opened an [GMT issue](https://github.com/GenericMappingTools/gmt/issues/6125))

```julia
using GMT

plot([315,30], marker=:circ, mc=:green, ms=0.2, region=:global,
     proj=(name=:Stereographic, center=(0,0)),
     frame=(annot=:auto, grid=:auto), show=true, coast=true)
psxy [WARNING]: Latitude (315) at line # 1 exceeds -|+ 90! - set to NaN

```

 ![GMTjl_tmp-fs8](https://global.discourse-cdn.com/julialang/original/3X/d/9/d9557a0f9881d6b3e236bf1c8792b056a1e8d20b.png)

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [December 15, 2021, 7:57pm UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/6 "2021-12-15T19:57:11Z")

</div>

Some good news. It turns out the bug lies somewhere in the data transference between Julia and the the GMT lib. Things work well if one saves the data to be plotted in a text file and plot it after.  
This works. Note, I’m plotting the coastlines just confirm that the data plots where it should.

```julia
plot("point.txt", marker=:circ, mc=:green, ms=0.2, region=:global, proj=(name=:Stereographic, center=(0,0)), frame=(annot=:auto, grid=:auto), show=true, coast=true)

```

 ![GMTjl_tmp-fs8](https://global.discourse-cdn.com/julialang/original/3X/1/0/103917af8cc4b1bdf2a3ba1edf91c6a0920ceccd.png)

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [December 16, 2021, 12:20am UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/7 "2021-12-16T00:20:01Z")

</div>

> [@joa-quim](#):
>
> ```julia
> plot([315,30], marker=:circ, mc=:green, ms=0.2, region=:global,
> proj=(name=:Stereographic, center=(0,0)),
> frame=(annot=:auto, grid=:auto), show=true, coast=true)
> 
> ```

Sorry, my bad. No bug at all. Only in my command, which used a vector (which meant two points without _xx_ coordinates in this case) as input when it should have used a matrix.  
This works as expected

```julia
plot([315 30], marker=:circ, mc=:green, ms=0.2, region=:global,
     proj=(name=:Stereographic, center=(0,0)),
     frame=(annot=:auto, grid=:auto), show=true, coast=true)

```

---

<div class="post-metadata">

**Author:** ![Gravlax](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Post date:** [December 16, 2021, 10:13am UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/8 "2021-12-16T10:13:45Z")

</div>

> [@joa-quim](#):
>
> solved it by removing the bundle

if I may ask, how did you proceed for this cleaning step?  
Let’s hope this will not be an issue on more recents macs…

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [December 16, 2021, 11:16am UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/9 "2021-12-16T11:16:13Z")

</div>

But are you using the GMT bundle distributed by the GMT site? If yes then just remove the GMT installation from the Applications dir like you do with any other apps.  
And no, unfortunately this does not depend on the Macs age, it’s an Apple long standing issue for which we never found a solution.

---

<div class="post-metadata">

**Author:** ![Gravlax](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Post date:** [December 17, 2021, 1:43pm UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/10 "2021-12-17T13:43:12Z")

</div>

> [@joa-quim](#):
>
> But are you using the GMT bundle distributed by the GMT site?

No I’ve installed GMT from macports. Now GMT.jl loads:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/b/2b6418f37eb351b83916509e7fee5a5e57fa5d72.png)  
but the figure does not look as nice:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/2/b29d4bbee12abe8d976a3c0d3c9949804636fd04.png)  
I’ll probably reinstall everything over again and get things running during the next weeks.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [December 17, 2021, 2:13pm UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/11 "2021-12-17T14:13:59Z")

</div>

Yep, a MacPorts build should be OK too. But I’m pretty sure that the plot above was **not** produced by GMT. Better to post the plotting command.

---

<div class="post-metadata">

**Author:** ![Gravlax](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Post date:** [December 17, 2021, 2:39pm UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/12 "2021-12-17T14:39:39Z")

</div>

Ah OK, I see (my) things are messy. I’ve used your plotting [command](https://discourse.julialang.org/t/stereonet-diagram/73121/7) , but since Plots.jl was already loaded, seems `Plots.plot` was used as default - that’s why it looked weird.  
Now I’ve forced to use GMT.jl by replacing the plot command to `GMT.plot` and I’m now back to the original `libgdal` problem. I’ll try the homebrew version then. Thanks again for your hints 😃

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [December 17, 2021, 2:54pm UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/13 "2021-12-17T14:54:23Z")

</div>

On a second (and more attentive) read of the error message, yes that’s a problem with the macports build. It shows the \*nix suffering of permanent dependencies breaking.  
At least on clean starts the `homebrew` build works fine. I’, saying this because yesterday I added MacOS to the GMT.jl CI tests and it worked fine.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [August 20, 2025, 12:49pm UTC](https://discourse.julialang.org/t/stereonet-diagram/73121/14 "2025-08-20T12:49:14Z")

</div>

If anyone comes here again, GMT.jl has now a stereonet function that let us do

```julia-auto
stereonet([90 30; 180 45; 270 60; 0 15; 30 45; 120 48; 225 27; 350 80])

```

 ![GMTjl_j](https://global.discourse-cdn.com/julialang/original/3X/1/d/1dc96d4712c3d33fc53eb6789e621577e4368f33.jpeg)
