# Gmt psxy

**URL:** <https://forum.generic-mapping-tools.org/t/gmt-psxy/2604>\
**Category:** Q&A\
**Created:** [February 8, 2022, 3:08am UTC](https://forum.generic-mapping-tools.org/t/gmt-psxy/2604 "2022-02-08T03:08:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shemsee](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@shemsee](https://forum.generic-mapping-tools.org/u/shemsee)\
**Post date:** [February 8, 2022, 3:08am UTC](https://forum.generic-mapping-tools.org/t/gmt-psxy/2604/1 "2022-02-08T03:08:03Z")

</div>

Hi every one, i am new here and i need your help please !

So I am a student in geology at master degree, and I am doing an internship about gravity variation.  
I am a new user of GMT, and I am not afraid to say I am a very big noob.  
I have to make a map with gravity variation from airbone data. I followed tutorials to create a map, and I used psbasemap and pscoast successfully. But now I have to add points and each point have to represent gravity value. The problem is these values are in txt file and i don’t know how i can call my data from this file. In my file they are many columns like location in rad time altitude etc…is if someone can help me I will appreciate it ( sorry for my broken English )

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [February 8, 2022, 3:34am UTC](https://forum.generic-mapping-tools.org/t/gmt-psxy/2604/2 "2022-02-08T03:34:04Z")

</div>

Depends on the format. If you have longitude and latitude in columns a and b and your gravity value in column c (and a, b,c are not the three first columns 0, 1, 2) then you need to use **-i** to select which columns you want.

---

<div class="post-metadata">

**Author:** ![shemsee](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@shemsee](https://forum.generic-mapping-tools.org/u/shemsee)\
**Post date:** [February 8, 2022, 4:37pm UTC](https://forum.generic-mapping-tools.org/t/gmt-psxy/2604/3 "2022-02-08T16:37:38Z")

</div>

Thank you for your answer, after many try I found how I can do it : actually I used “awk” to extract columns on new file like this :

```auto
awk '{print $3 ,$2, $7}' $ datafile.txt > gravipoints.txt.

```

Each $ followed by number matches with a column in original data files after, i used

```auto
gmt psxy gravipoints.txt -R -JQ -Sc0.09 -C$CPT -O -K -X -Y >> $PLOT

```

to get map with points .

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [February 8, 2022, 5:36pm UTC](https://forum.generic-mapping-tools.org/t/gmt-psxy/2604/4 "2022-02-08T17:36:28Z")

</div>

The recommendation was to use the option **-i**. More elegant

```auto
gmt psxy gravipoints.txt -i2,1,6 -R -JQ -Sc0.09 -C$CPT -O -K >> $PLOT

```

---

<div class="post-metadata">

**Author:** ![shemsee](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@shemsee](https://forum.generic-mapping-tools.org/u/shemsee)\
**Post date:** [February 8, 2022, 6:01pm UTC](https://forum.generic-mapping-tools.org/t/gmt-psxy/2604/5 "2022-02-08T18:01:43Z")

</div>

Thank you very much Joaquim I appreciate your help, in deed it’s quicker and more elegant.
