# FMS plotting issue in pygmt?

**URL:** <https://forum.generic-mapping-tools.org/t/fms-plotting-issue-in-pygmt/3970>\
**Category:** PyGMT Q&A\
**Created:** [May 25, 2023, 1:06pm UTC](https://forum.generic-mapping-tools.org/t/fms-plotting-issue-in-pygmt/3970 "2023-05-25T13:06:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adnan](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@Adnan](https://forum.generic-mapping-tools.org/u/Adnan)\
**Post date:** [May 25, 2023, 1:06pm UTC](https://forum.generic-mapping-tools.org/t/fms-plotting-issue-in-pygmt/3970/1 "2023-05-25T13:06:18Z")

</div>

Hi everyone,  
I am trying to plot FMS as per the instruction provided on pygmt web page. However, i did not get any result. Error message saying that my file is not in correct format. May someone suggest me how i can prepare a file including the label text for each FMS beach ball.

```
 data=pd.read_csv("FMS.txt", sep='\s+')
 fig.meca(spec=data, convention='aki', offset=True, scale='0.3c', C=True)

```

[FMS.txt](https://forum.generic-mapping-tools.org/uploads/short-url/uhx6EGlRHo44Jl5Mf9bBj0pVbnV.txt) (280 Bytes)

---

<div class="post-metadata">

**Author:** ![yvonnefroehlich](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/yvonnefroehlich/32/5064_2.png) [@yvonnefroehlich](https://forum.generic-mapping-tools.org/u/yvonnefroehlich)\
**Post date:** [May 25, 2023, 3:25pm UTC](https://forum.generic-mapping-tools.org/t/fms-plotting-issue-in-pygmt/3970/2 "2023-05-25T15:25:45Z")

</div>

Hello @Adnan,

You have to use `longitude` and `latitude` for the columns names, instead of `lon` and `lat`.

Futhermore it looks like you mixed up longitude and latitude for either the event location (colums `longitude` and `latitude`) or the plot location (colums `plot_latitude` and `plot_longitude`) in your FMS.txt file:

```auto
longitude	latitude	depth	strike	dip	rake	magnitude	plot_latitude	plot_longitude 
73.47	34.38	12.0	334	40	123	7.6	73.67	34.42	
71.27	32.95	15.0	237	5	79	6	71.40	33.05
73.85	32.83	14.7	246	10	52	5.9	73.95	33.00
73.21	33.92	22.1	148	82	6	5	73.31	34.00	
73.51	32.62	24.7	246	21	61	4.9	73.39	32.50 

```

To add labels to the single beachballs you need a column `event_name` containing the desired text:

```auto
longitude	latitude	depth	strike	dip	rake	magnitude	plot_latitude	plot_longitude event_name
73.47	34.38	12.0	334	40	123	7.6	73.67	34.42	event_1
71.27	32.95	15.0	237	5	79	6	71.40	33.05	event_2
73.85	32.83	14.7	246	10	52	5.9	73.95	33.00	event_3
73.21	33.92	22.1	148	82	6	5	73.31	34.00	event_4
73.51	32.62	24.7	246	21	61	4.9	73.39	32.50 event_5

```

---

<div class="post-metadata">

**Author:** ![Adnan](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@Adnan](https://forum.generic-mapping-tools.org/u/Adnan)\
**Post date:** [June 17, 2023, 5:49am UTC](https://forum.generic-mapping-tools.org/t/fms-plotting-issue-in-pygmt/3970/3 "2023-06-17T05:49:45Z")

</div>

> [@Adnan](#):
>
> ```auto
> data=pd.read_csv("FMS.txt", sep='\s+')
> fig.meca(spec=data, convention='aki', offset=True, scale='0.3c', C=True)
> 
> ```

Thanks for suggestions,

It works well but only without the event label.  
For example, if i use the following format, it plots the FMS

```auto
longitude	latitude	depth	strike	dip	rake	magnitude	plot_longitude	plot_latitude
73.47	34.38	12	334	40	123	6.4	73.85	34.75

```

But when I add the event label, then error.

```auto
longitude	latitude	depth	strike	dip	rake	magnitude	plot_longitude	plot_latitude	event_name
73.47	34.38	12	334	40	123	6.3	73.85	34.75	m6-2010

```

Plus, I also like to include direction from epicenter toward the source.

---

<div class="post-metadata">

**Author:** ![uk301](https://avatars.discourse-cdn.com/v4/letter/u/94ad74/32.png) [@uk301](https://forum.generic-mapping-tools.org/u/uk301)\
**Post date:** [August 20, 2024, 12:25am UTC](https://forum.generic-mapping-tools.org/t/fms-plotting-issue-in-pygmt/3970/4 "2024-08-20T00:25:23Z")

</div>

> [@Adnan](#):
>
> ```auto
> ke	magnitude	plot_longitude	plot_latitude	event_name
> 73.47	34.38	12	334	40	123	6.3	73.85	34.75	m6-2010
> 
> ```

Try separating your values with a tab, not a space.  
Good luck!
