# Is there a way to set both date format and tick interval in time colorbars?

**URL:** <https://forum.generic-mapping-tools.org/t/is-there-a-way-to-set-both-date-format-and-tick-interval-in-time-colorbars/5583>\
**Category:** Q&A\
**Created:** [November 29, 2024, 6:20pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-set-both-date-format-and-tick-interval-in-time-colorbars/5583 "2024-11-29T18:20:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![julioli](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@julioli](https://forum.generic-mapping-tools.org/u/julioli)\
**Post date:** [November 29, 2024, 6:20pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-set-both-date-format-and-tick-interval-in-time-colorbars/5583/1 "2024-11-29T18:20:18Z")

</div>

Hi everyone,  
I am plotting seismic events with color according to their date of occurrence, and want to show the corresponding colorbar as reference. Next is the code I am using: (cpt is previously created with makecpt)

gmt colorbar -C -DjBR+o0.52c/0.35c+w-4c/0.4c+m -F+p1+gwhite+r+c-0.5/0.1/0.1/0.1 -Baf -By+l"Fecha" --FONT\_ANNOT\_PRIMARY=8p   
–FONT\_LABEL=8p --MAP\_FRAME\_PEN=0.8p --MAP\_TICK\_LENGTH=0.1c --GMT\_LANGUAGE=ES --FORMAT\_DATE\_MAP=dd-mm

The problem is that the automatic tick setting (-Baf) will do things like the following:

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

But if I try to set the tick interval to a fixed value, like -Ba15d, I lose the date format that I am trying to use (dd-mm), like you can see here:

 ![Captura2](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/5/5f29edf721cd476060b511b75a6cc32f6d8775b9.jpeg)

Is there a workaround for this? I want to have a colorbar that will display ticks every 15 days in dd-mm format, no matter the total timespan (one, two, three months or any other amount of days in between)

I am using GMT 6.3 due to some issues we had when trying to update to the latest in our server.

Thank you in advance for your help

---

<div class="post-metadata">

**Author:** ![mkononets](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mkononets/32/4029_2.png) [@mkononets](https://forum.generic-mapping-tools.org/u/mkononets)\
**Post date:** [November 30, 2024, 3:27pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-set-both-date-format-and-tick-interval-in-time-colorbars/5583/2 "2024-11-30T15:27:58Z")

</div>

try `-Ba15D` with capital `D`

based on the [4. Standardized command line options — GMT 6.5.0 documentation](https://docs.generic-mapping-tools.org/6.5/reference/options.html#axes-settings) table with _stride units_:

```auto
D date Format annotation using FORMAT_DATE_MAP
d day Plot day of month (1–31) or day of year (1–366) (see FORMAT_DATE_MAP)

```

---

<div class="post-metadata">

**Author:** ![julioli](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@julioli](https://forum.generic-mapping-tools.org/u/julioli)\
**Post date:** [December 3, 2024, 6:01pm UTC](https://forum.generic-mapping-tools.org/t/is-there-a-way-to-set-both-date-format-and-tick-interval-in-time-colorbars/5583/3 "2024-12-03T18:01:00Z")

</div>

Thank you very much! I didn’t know about that difference between using d and D. It worked fine.
