# Custom annotations on the x-axis with GMT 6

**URL:** <https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320>\
**Category:** Q&A\
**Created:** [March 25, 2020, 5:02am UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320 "2020-03-25T05:02:13Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![axelwang](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@axelwang](https://forum.generic-mapping-tools.org/u/axelwang)\
**Post date:** [March 25, 2020, 5:02am UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/1 "2020-03-25T05:02:13Z")

</div>

I am trying to plot a seismic record section using GMT 5.4.x, my code reads

gmt pswiggle -R0/13/0/450 -Bxcxlabel355.dat+l"Distance (km)" -Bya100fg100+l"Reduced time (s)" -BnWSe   
-JX4i/2.22i -Z4i -Wthinnest,black -gy1 -K -X3i seis355.dat -V \>$ps``

with my xlabel355.dat file reads  
1 a 489  
2.5 a 590  
4 a 1022  
5.5 a 712  
7 a 1363  
8.5 a 852  
10 a 1006  
11.5 a 1114

This worked perfectly fine! However, I would like my x-axis annotations to be slanted, and I just discovered GMT 6 has added the +a option on -B so I updated to GMT 6. Then weird things start to happen.

The code above stops working. It runs smoothly, but will plot NO x-axis annotations other than the x-axis title `Distance (km)`. (Fig2)

 ![fig2](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/c1fa8bb00e367eaeed591523ea77f9a112781d4d.jpeg)

If I change -Bx to -Bxa1, then the normal annotations will appear fine (Fig 1),

 ![fig1](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/75cd0c9ca2d697fd9ba26f303cd153416c1d1215.jpeg)

and I have checked the +a option works fine also.

I am really not sure what went wrong here. Really the only thing I changed was updating to GMT 6. Thank you so much for helping!

---

<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:** [March 25, 2020, 3:48pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/2 "2020-03-25T15:48:00Z")

</div>

Don’t know if some bug existed and was fixed meanwhile but works fine with the GMTdev version. And, please use the **-A** option to `psconvert` to trim out the white space

```auto
psbasemap -R0/13/0/450 -Bxcxlabel355.dat+l"Distance (km)"+a45 -Bya100fg100+l"Reduced time (s)" -BnWSe -JX4i/2.22i > lixo.ps
psconvert lixo.ps -A -Tg

```

 ![lixo](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/3f671daeadeae3e3bfae22e58b1112002dd50e54.png)

---

<div class="post-metadata">

**Author:** ![seisman](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/seisman/32/4_2.png) [@seisman](https://forum.generic-mapping-tools.org/u/seisman)\
**Post date:** [March 25, 2020, 5:37pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/3 "2020-03-25T17:37:49Z")

</div>

> [@Joaquim](#):
>
> gmt psbasemap -R0/13/0/450 -Bxcxlabel355.dat+l"Distance (km)“+a45 -Bya100fg100+l"Reduced time (s)” -BnWSe -JX4i/2.22i \> lixo.ps

Just tried @Joaquim’s command above with GMT 6.0.0. It works well for me.

Please check if this command works for you. If yes, then you could attach your data files so we can check if it’s an issue of pswiggle.

---

<div class="post-metadata">

**Author:** ![axelwang](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@axelwang](https://forum.generic-mapping-tools.org/u/axelwang)\
**Post date:** [March 25, 2020, 8:04pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/4 "2020-03-25T20:04:01Z")

</div>

hey Joaquim and Seisman,  
Thank you both for your help. I just tried to used pswiggle in combination with psbasemap and I think everything worked fine (Fig 1)

 ![Fig1](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/b2a505dfce56876f56cbeca9de2d1dfea4c6d16f.png)

It seems this could be an issue with pswiggle. I tried to upload my data file but it is too big to upload here. Let me know if you would like me to send it as an email.

Thanks again!

---

<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:** [March 25, 2020, 8:34pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/5 "2020-03-25T20:34:06Z")

</div>

Looks like we do not have considered moving the labels further from the axis when +a is used. Opening an issue on that.

---

<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:** [March 25, 2020, 8:42pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/6 "2020-03-25T20:42:35Z")

</div>

A quick adaptation of one of my julia tests shows that it works for `pswiggle` (as it should because it calls the same code as `psbasemap`)

 ![wig](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/b64adf8f7805ed0a2d7a6b572dc43dc17b934cfb.png)

---

<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:** [March 25, 2020, 8:54pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/7 "2020-03-25T20:54:28Z")

</div>

Yes, there is nothing pswiggle-specific here. But we do have a “feature” in the axis offset distance.

---

<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:** [March 25, 2020, 8:56pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/8 "2020-03-25T20:56:10Z")

</div>

Yes, I saw it in first plot. But that’s a PS controlled thing, no? One needs to know the length of the annotations.

---

<div class="post-metadata">

**Author:** ![axelwang](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@axelwang](https://forum.generic-mapping-tools.org/u/axelwang)\
**Post date:** [March 25, 2020, 10:08pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/9 "2020-03-25T22:08:00Z")

</div>

The custom annotations do not get plotted regardless if +a is used or not in pswiggle.  
If there is nothing pswiggle specific, which I believe could definitely be the case, how can I modify my original code to have plotted everything together (content plus frame) using just one call on pswiggle?  
Right now I am plotting the content using pswiggle and the frame using psbasemap.  
Thank you!

---

<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:** [March 25, 2020, 11:43pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/10 "2020-03-25T23:43:28Z")

</div>

Can you cut your dataset to just one trace (or part of it), zip it and attach here as well as the full pswiggle command?

---

<div class="post-metadata">

**Author:** ![axelwang](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@axelwang](https://forum.generic-mapping-tools.org/u/axelwang)\
**Post date:** [March 26, 2020, 12:49am UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/11 "2020-03-26T00:49:10Z")

</div>

[partialTrace1.dat.zip](https://forum.generic-mapping-tools.org/uploads/short-url/LfPLumTrZxNuxxJDx2hT0P9Stz.zip) (32.5 KB)  
Hey Joaquim,  
Here is part of my first trace. The pswiggle command I used is:  
gmt pswiggle -R0/13/0/450 -Bxcxlabel355.dat+l"Distance (km)" -Bya100fg100+l"Reduced time (s)" -BnWSe  
-JX4i/2.22i -Z4i -Wthinnest,black -gy1 -K -X3i seis355.dat -V \>$ps

The same as in my original question. Thank you!

---

<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:** [March 26, 2020, 12:11pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/12 "2020-03-26T12:11:38Z")

</div>

@axelwang It turned out to be a bug in `pswiggle`. Now fixed, see [https://github.com/GenericMappingTools/gmt/pull/2976](https://github.com/GenericMappingTools/gmt/pull/2976)

Thanks for bringing this up

---

<div class="post-metadata">

**Author:** ![axelwang](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@axelwang](https://forum.generic-mapping-tools.org/u/axelwang)\
**Post date:** [March 26, 2020, 7:28pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/13 "2020-03-26T19:28:31Z")

</div>

Thank you all for the help and the quick fix. BTW, is there a way to plot two sets of custom labels on either side (top or bottom) of x-axis or left and right of y -axis? Thanks!

---

<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:** [March 26, 2020, 7:41pm UTC](https://forum.generic-mapping-tools.org/t/custom-annotations-on-the-x-axis-with-gmt-6/320/14 "2020-03-26T19:41:44Z")

</div>

If I recall, it is possible that if you give -Bxcfile1 and -Bycfile2 it fails. But you can work around that by placing one of the custom annotions via one module (e.g., pswiggle) and the other via an overlay by psbasemap.
