# How to color the gps velocity vector (plotted with gmt psvelo) as a cpt palette?

**URL:** <https://forum.generic-mapping-tools.org/t/how-to-color-the-gps-velocity-vector-plotted-with-gmt-psvelo-as-a-cpt-palette/1498>\
**Category:** Q&A\
**Created:** [March 26, 2021, 8:14am UTC](https://forum.generic-mapping-tools.org/t/how-to-color-the-gps-velocity-vector-plotted-with-gmt-psvelo-as-a-cpt-palette/1498 "2021-03-26T08:14:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandur](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@sandur](https://forum.generic-mapping-tools.org/u/sandur)\
**Post date:** [March 26, 2021, 8:14am UTC](https://forum.generic-mapping-tools.org/t/how-to-color-the-gps-velocity-vector-plotted-with-gmt-psvelo-as-a-cpt-palette/1498/1 "2021-03-26T08:14:35Z")

</div>

Hello,  
I’m a neophyte with GMT and I’m programming with bash.  
I’ve plotted the GPS velocity vectors with gmt psvelo, but I would like to color the velocity vectors in function of their velocities with a .cpt palette.

gmt makecpt -Cdeepskyblue,blue,salmon,darkred,black -T0,10,20,30,40,50 \> gps\_vel.cpt  
cat gps.vel.tot | awk ‘{print $2,$3,$4,$6,$5,$7,$8}’ | gmt psvelo $J $R $Se -Wdeepskyblue -Gblue -K -O \>\> $out

Many thank’s to those who could help me!

---

<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:** [March 26, 2021, 3:00pm UTC](https://forum.generic-mapping-tools.org/t/how-to-color-the-gps-velocity-vector-plotted-with-gmt-psvelo-as-a-cpt-palette/1498/2 "2021-03-26T15:00:18Z")

</div>

Add -Cgps\_vel.cpt to gmt psvelo instead of -Gblue?

---

<div class="post-metadata">

**Author:** ![sandur](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@sandur](https://forum.generic-mapping-tools.org/u/sandur)\
**Post date:** [March 26, 2021, 3:54pm UTC](https://forum.generic-mapping-tools.org/t/how-to-color-the-gps-velocity-vector-plotted-with-gmt-psvelo-as-a-cpt-palette/1498/3 "2021-03-26T15:54:10Z")

</div>

Thanks for reply. No, unfortunately is not run with -C_xxx_.cpt

---

<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:** [March 26, 2021, 8:07pm UTC](https://forum.generic-mapping-tools.org/t/how-to-color-the-gps-velocity-vector-plotted-with-gmt-psvelo-as-a-cpt-palette/1498/4 "2021-03-26T20:07:47Z")

</div>

I think that you should do what @PlanetGus says and your data must be prepare:

“… it expects the user to supply a multisegment file where each segment header contains a **-Z** _val_ string. The _val_ will control the color of the line or polygon (if **-L** is set) via the CPT.”

---

<div class="post-metadata">

**Author:** ![sandur](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@sandur](https://forum.generic-mapping-tools.org/u/sandur)\
**Post date:** [March 29, 2021, 8:27am UTC](https://forum.generic-mapping-tools.org/t/how-to-color-the-gps-velocity-vector-plotted-with-gmt-psvelo-as-a-cpt-palette/1498/5 "2021-03-29T08:27:47Z")

</div>

Many thanks @Esteban82.  
I wrote the psvelo line as:  
cat gps.vel.tot | awk ‘{print $2,$3,$4,$6,$5,$7,$8}’ | gmt psvelo $J $R $Se -Wblue -Cgps\_vel.cpt -L -Z -K -O \>\> $out

but the output is only the blue gps vectors, without a continous gradataion of the cpt. I would like that the gps vectors has colours which varies according to the velocity…

---

<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:** [March 29, 2021, 6:27pm UTC](https://forum.generic-mapping-tools.org/t/how-to-color-the-gps-velocity-vector-plotted-with-gmt-psvelo-as-a-cpt-palette/1498/6 "2021-03-29T18:27:53Z")

</div>

Umm I see. What GMT version are you using? Maybe you could try with psxy/plot instead of psvelo.
