Plotting geological symbols in pygmt

Hi! This is my first question in the forum, so I hope its appropriate.
I want to make a geological map with the strike and dip symbol, similar to this

I have a pandas dataframe that has this format: X, Y, Strike, Width, Height
X Y Strike Width Height
0 -55.650291 -40.496231 -50 1 0.1
1 -55.732244 -40.590901 140 1 0.1
2 -55.668790 -40.773065 45 1 0.1
3 -55.327952 -40.580237 45 1 0.1
4 -55.867853 -40.860880 -40 1 0.1
5 -55.250086 -40.788963 120 1 0.1
6 -55.475404 -40.433223 45 1 0.1
7 -55.988937 -40.577493 140 1 0.1
8 -55.573302 -40.378263 150 1 0.1

The closest function I found on pygmt is the fig.plot() method with multiparameter symbols. This is my attempt

import pygmt
import pandas as pd
fig = pygmt.Figure()
pygmt.config(MAP_FRAME_AXES='WesN')

fig.plot(data=strikes_df,style="j", color="red3", pen="1p,black") 
fig.basemap(
    frame=True,
    projection="M15c",
    rose="n0.9/0.92+w1.5c+f",
    map_scale="n0.9/0.05+w5k+f+l"
)
fig.show()

I’m getting a proper result, but I would like to get the strike and dip symbol instead of a rectangle. I know GMT has a colection of geological symbols (GMT geological symbols — GMT 6.0.0 documentation) so I’m wondering if something similar can be plotted in pygmt.

Thanks in advance!

Hi Seba!! Welcome to the forum!!

I managed to get the symbol by adding it to the folder gmt6/share/custom a file named geo-plane.def with the content of the following link:

I don’t know if that file (and the other custom symbols) should be already in that folder, or if is there a way to download them together.

Excelent! With that solution and writing

fig.plot(data=strikes_df,style=“kgeo-plane/0.5c”)

it plots the symbols perfectly.

Thanks Fede!

Well, plot docs say that

-Skname/size

kustom symbol. We will look for a symbol definition file called name.def in (1) the current directory, (2) in ~/.gmt or (3) in $GMT_SHAREDIR/custom. …

Yes, but when I run the code and I get the message below. That is why I have to manually add the file. It seems a bit weird to me.

plot [ERROR]: Could not find either custom symbol or EPS macro geo-plane

Worked fine here with the geo-plane.def file either in current dir or in my .gmt

plot("ss.dat", marker=(custom="geo-plane", size=0.4), show=1) # ss.dat has the points in first post

Ok. I see. Is there any way to download all the geological symbols?

Also, I see in your figure that some symbols are cut (like the one in 5). I got the same in mine. Is this ok?

Yes, the cutting is a possibility. Limits are automatic in my fig.
The symbols are in ...master\doc\rst\source\users-contrib-symbols\geology

I don’t understand. Do you copied the def files within that folder to (1) the current directory, (2) in ~/.gmt or (3) in $GMT_SHAREDIR/custom. ? Or GMT should be able to find those files within master\doc\rst\source\users-contrib-symbols\geology ?

If you want to use them outside of the docs building environment you have to copy the symbols into a place that GMT can find them.

My doubt is why I got the message below. Is it ok? Why GMT can find those files if they are already in the GMT folder? Should GMT be able to search for them in master\doc\rst\source\users-contrib-symbols\geology ?

plot [ERROR]: Could not find either custom symbol or EPS macro geo-plane

GMT can’t find those in master\doc\rst\.... The 3 places where they can be is what explained in the docs. It works fine for me. During the docs building some setting must be set (for example changing temporarily $GMT_SHAREDIR) that allows those symbols to be found without further copies.

Ok, that is only possible for those who build GMT from source, right?
Those who use the installers (e.g. gmt-6.3.0-win64.exe) can’t, right?

We used to have those custom collections zipped in a single file for users to download (from the GMT site). Maybe they were lost.

They are there - in GMT documentation sidebar

I found them there but as separate files. Or do you mean that all the 25 geological simbols are in a single zip file available for download?

I think that got lost during the transition to git and CIs. I will open an issue.