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

**URL:** <https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524>\
**Category:** Q&A\
**Created:** [January 18, 2022, 10:53am UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524 "2022-01-18T10:53:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 18, 2022, 10:53am UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/1 "2022-01-18T10:53:33Z")

</div>

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 …

---

<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:** [January 18, 2022, 12:15pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/2 "2022-01-18T12:15:34Z")

</div>

Sample grids at specified (x,y) locations? See [https://docs.generic-mapping-tools.org/dev/grdtrack.html](https://docs.generic-mapping-tools.org/dev/grdtrack.html).

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 18, 2022, 3:15pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/4 "2022-01-18T15:15:54Z")

</div>

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 |

---

<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:** [January 18, 2022, 4:30pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/5 "2022-01-18T16:30:15Z")

</div>

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

> <https://github.com/Esteban82/AGA-Geoinformatica-2021/tree/main/1_Ejercicios/09G_Wadati-Benioff>
>
> //github.com/Esteban82/AGA-Geoinformatica-2021/tree/main/1\_Ejercicios/09G\_Wadati-Benioff

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 25, 2022, 9:43am UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/6 "2022-01-25T09:43:27Z")

</div>

![41561_2016_Article_BFngeo2701_Fig1_HTML](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/f/f7dbca78ed57db4418329718907ad59dadc61c33.jpeg)

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.

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [January 25, 2022, 1:01pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/7 "2022-01-25T13:01:36Z")

</div>

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](https://docs.generic-mapping-tools.org/dev/gallery/ex22.html).

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 25, 2022, 1:41pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/9 "2022-01-25T13:41:25Z")

</div>

![Screenshot (745)](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/8/888b8849cfd781eeeb7a2383d27312732203859e.png)

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?

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [January 25, 2022, 1:55pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/10 "2022-01-25T13:55:25Z")

</div>

That would be with `-J` :

> -JX10c/-8c

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

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [January 25, 2022, 1:58pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/11 "2022-01-25T13:58:01Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 25, 2022, 2:10pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/12 "2022-01-25T14:10:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [January 25, 2022, 2:21pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/13 "2022-01-25T14:21:22Z")

</div>

What’s the error ?

The complete script probably need a

> gmt begin myfigure png

> gmt makecpt […]  
> gmt plot […]

> gmt end show

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 25, 2022, 3:53pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/14 "2022-01-25T15:53:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [January 25, 2022, 4:09pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/15 "2022-01-25T16:09:37Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 25, 2022, 4:17pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/16 "2022-01-25T16:17:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [January 25, 2022, 4:49pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/17 "2022-01-25T16:49:11Z")

</div>

Right sorry,

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

so you need `-i2,5,5`

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 25, 2022, 5:07pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/18 "2022-01-25T17:07:18Z")

</div>

how can use this track ?

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [January 25, 2022, 5:21pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/19 "2022-01-25T17:21:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 25, 2022, 5:26pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/20 "2022-01-25T17:26:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [January 25, 2022, 5:32pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/21 "2022-01-25T17:32:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![annafiglioli](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@annafiglioli](https://forum.generic-mapping-tools.org/u/annafiglioli)\
**Post date:** [January 25, 2022, 5:44pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524/22 "2022-01-25T17:44:33Z")

</div>

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

[Next page](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-create-profiles-where-earthquakes-are-plotted-with-depths/2524.md?page=2)
