Is there a way to create profiles where earthquakes are plotted with depths?

I was wondering if there were some very simple ways, that I have already been able to see for example with gmt project, to create profiles with GMT 6.0?
I apologize if my questions seem trivial or stupid but I have been approaching GMT very recently …

Sample grids at specified (x,y) locations? See

i use this codes that i read here

gmt project C:\programs\MAGNITUDE.CSV -Q -C14.50000/38.00000 -E104.0/-2 -Fpz -W-100/100

  gmt basemap -JX7i/-6 -R0/700/0/50 -Bxafg100+l"Distance"  -Byafg50+l"Depth" -BWSen -Y-8

  gmt psxy C:\programs\MAGNITUDE.CSV -JX  -Sc0.2 -W1 -Gred

  echo 10 10 A > word2

  echo 490 10 B >> word2

  gmt text word2 -JX -F+f13,Helvetica

but is very difficult have the good results.

For example i want to do a profile in -R14.50000/38.00000
with earthquake and depth…is there in my MAGNITUDE csv
first lon,lat,mag,dep.
This is the sequence in CSV code.

this is a part of csv

43476 16.2912 38.0087 2.3 10.7
43477 16.2912 38.0087 2.3 10.7
43478 16.2912 38.0087 2.3 10.7
43479 16.2912 38.0087 2.3 10.7
43480 16.2912 38.0087 2.3 10.7
43481 16.2912 38.0087 2.3 10.7
43482 16.2912 38.0087 2.3 10.7
43483 16.2912 38.0087 2.3 10.7
43484 16.2912 38.0087 2.3 10.7
43485 16.2912 38.0087 2.3 10.7
43486 13.196 42.7892 1.1 5.4

Maybe this could help you (see the script and figure).


unfortunately I had a series of problems re-adapting your tool to my needs.

I propose this sceenshot taken from the internet to make you understand better or worse what my result should be.

I want that and in the map I would like to have lines that differ to the specific depth / distance profile.

If you have a file with

  • column 0 : distance (or time)
  • column 1 : depth

you can simply use :

gmt plot myfile.txt -Sc0.2c -Gblue -Baf -By+l"Depth" -Bx+l"Distance"

That would create a blue scatter plot with circles of 0.2cm radii.

As for the map, you can certainly adapt the example from doc.

thank so much @PlanetGus probabily it no very well because i use the latitude specific and depth…no distance or time because no it usefull. the tool don’t work.

i have another question…how plot depth start to 0 on the top and no at the botton?

That would be with -J :


This will specify a cartesian projection (X), 10cm wide (x ascending order) and 8cm high (y descending order).

Just to anticipate :
If you know (approximatively) the fault direction, you can use track to plot depth/distance along the fault… (see example 33 on documentation)

in my map i have this condition
gmt makecpt -Cred,green,blue -T0,139.2,278.2,417.3 -N

gmt plot C:\programs\Instance_Sicilia.CSV -C -Sci -Wfaint -hi1 -i1,2,5,4+s0.015

why if i try to put the makecpt to plot it is not work. I receive a error!
I want to use the same color of the map in the plot detph/distance.

-i1,2,5,4+s0.015 this 5 is depht and 4 is magnitude.

What’s the error ?

The complete script probably need a

gmt begin myfigure png

gmt makecpt […]
gmt plot […]

gmt end show

C:\Users\Anna>gmt begin profile png

C:\Users\Anna>gmt makecpt -Cred,green,blue -T0,33,66,100 -N

C:\Users\Anna>gmt plot C:\programs\Instance_Sicilia.CSV -JX7/-4 -R37.90000/38.25500/0/100 -C -i2,5 -Sc0.05c -Baf -Bx+l"Distanza" -By+l"Depth"
plot [WARNING]: Mismatch between actual (2) and expected (3) fields near line 2 in file C:\programs\Instance_Sicilia.CSV

C:\Users\Anna>gmt end show
Error: /syntaxerror in /–%ztokenexec_continue–

this is the error and the code

You are asking gmt to plot columns 3 and 6 in your csv file. Is that what you want ? (-i2,5 count starts at 0)

4005 14.7365 38.7465 2012-06-25T00:02:11.37Z 1.9 10.0
4006 14.7365 38.7465 2012-06-25T00:02:11.37Z 1.9 10.0

this is my file CSV

first 0
long 1
lat 2
time 3
mag 4
depht 5

I know. I select lat and depht. But i receive this error only if i want makecpt the same of map

Right sorry,

You need 3 columns :
{x,y} position (latitude , depth)
{z} value (here depth too)

so you need -i2,5,5

how can use this track ?

Well, your data are not gridded so you would need to transform them into a grid with xyz2grd for example, then follow the doc from grdtrack (or use the search function on the forum).

I’m not too versed in doing that operation though.

More than anything else I ask you why the plot Depht “distance”, which in my case I put only the Latitude, obviously not good … because it makes me the section for those latitudes and not for longitudes and therefore for a very specific section that I want.

Because I made the trace inside the map simply by defining the long and lat I want in a .txt file and the lines of interest to me appear in the map.

But in the plot the screen is made only of the lats because I feed him only and exclusively this.
Unless you can do it another way, without using the grdtrack.

If I understand correctly what you are asking, my answer stays the same : the easiest / fastest / most reliable way would be to transform your csv file into a grid then use grdtrack.

The most tedious one would be to try to select point with the nearest distance (can be achieved in various ways)

And the “I’m doing it once, no need to bother” is what you did : manually selecting the points of interest.

In the most boring way … what are the various ways to get what you say?