Time axis, issues with setting tick positions, tick label formatting and placement.
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- c
- Domain
- data-visualization
Research direction
Start by reproducing the issue with the four GMT basemap commands and compare their tick positions, label formats, and alignment with the gnuplot example. Read the GMT handling for -Bxa/-Bxf time axes and FORMAT_DATE_MAP/FORMAT_TIME_PRIMARY_MAP. Done means the requested 14-day positions, "%b %d"-style labels, and centered placement behave consistently without extra or misplaced labels.
Written by the indexing model from the issue text.
Description
I wanted to set X axis as time, set major ticks every 2 weeks (14 days), and format tick labels as "%b %d", aligned (centered) exactly at the axis tick positions. My example data range is a bit shorter than 2 months.
In short: I want to have time tick placement, labels format specs and label alignment as shown in my gnuplot example. I am not getting this with GMT. See more below.
My gnuplot code and figure is presented to demonstrate what I want and how it is specified. Further down I posted what I was able to get using GMT, the code and the results that I don't like at all - mostly erratic tick positions, misaligned tick labels, and label formats not respecting the requested specifications.
I want to get the same result I get with gnuplot. Gnuplot apparently (naively) counts 2-week intervals starting from the epoch. This way major ticks appear at 2019-02-21 etc. These major tick positions are a whole number of 2-week periods away from the epoch of 1970-01-01. I want to get the same tick positions and tick labels aligned the same way in GMT.
NB a standard way of specifying tick label format using C strftime format specifiers. A significant advantage for the user (me) that tick label of types Time and Date become essentially the same with this approach. Time/Date formatting seems two different things with GMT. It is not clear why it is so and what benefits it brings. The documentation and examples are scarce and scattered across several different places.
NB 1 Gnuplot's approach to the time interval/tick placement implies that regardless of the specified time interval all the time ticks and labels always remain at exactly the same positions.
My gnuplot code:
set term pngcairo enhanced size 800,80 font "Helvetica,14"
set output "gnuplot.png"
set xdata time
set timefmt "%Y-%m-%d"
set xrange ["2019-02-15" to "2019-04-08"]
set yrange [0 to 1]
unset ytics
set xtics 3600*24*14 nomirror out
set format x "%b %d"
set border 1
plot 0/0 notitle
Plot:
Now to my GMT trials and the results.
When I specify -Bxa14Rf7R the following --FORMAT_DATE_MAP="o dd" is not respected, label format is just the date of month, labels are misaligned and printed a bit away from the ticks:
gmt basemap -R2019-02-15T/2019-04-08T/-20/+20 -JX10c -BS -Bxa14Rf7R -png R --FORMAT_DATE_MAP="o dd" --FORMAT_TIME_PRIMARY_MAP=abbrev
When I specify -Bxa2Uf1U --FORMAT_DATE_MAP="o dd" --FORMAT_TIME_PRIMARY_MAP=abbrev label format is correct but the labels are misaligned and printed far away from the ticks:
gmt basemap -R2019-02-15T/2019-04-08T/-20/+20 -JX10c -BS -Bxa2Uf1U -png U --FORMAT_DATE_MAP="o dd" --FORMAT_TIME_PRIMARY_MAP=abbrev
When I specify -Bxa14Df7D --FORMAT_DATE_MAP="o dd" --FORMAT_TIME_PRIMARY_MAP=abbrev I get extra label at Apr 01 right on top of Mar 29, plus the labels are misaligned, that is, not centered exactly at the tick positions:
gmt basemap -R2019-02-15T/2019-04-08T/-20/+20 -JX10c -BS -Bxa14Df7D -png D --FORMAT_DATE_MAP="o dd" --FORMAT_TIME_PRIMARY_MAP=abbrev
With -Bxa14Df7D --FORMAT_DATE_MAP="o dd" --FORMAT_TIME_PRIMARY_MAP=abbrev i get essentially the same labels as before: only date is printed, aligned away from the tick positions. The requested abbreviated month name is just disregarded:
gmt basemap -R2019-02-15T/2019-04-08T/-20/+20 -JX10c -BS -Bxa14df7d -png d --FORMAT_DATE_MAP="o dd" --FORMAT_TIME_PRIMARY_MAP=abbrev
I want in principle to have time tick placement labels and formatting as in gnuplot. This implies tick labels centered exactly at the tick positions by default (interval labels centered at the center of the interval), standard label format specifiers and standard tick position evaluation as in gnuplot, that is, all tick positions relative to the epoch.
Congrats and thanks to all those who managed to read that far down.
- Dominant language
- C
- Stars
- 997
- Forks
- 420
- Avg merge
- 13h 27m
- Merged PRs (30d)
- 47
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GenericMappingTools/gmt
-
Add support for SCM 9.0.0 to GMTPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
GenericMappingTools/gmt#9316 · 10 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
GenericMappingTools/gmt#5767 · 15 comments ·
Maintainers usually reply within 1 day
-
discussion
Difficulty 5/5 Over a week Newbie friendliness 35/100
GenericMappingTools/gmt#9343 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
GenericMappingTools/gmt#9331 · 1 reaction ·
Maintainers usually reply within 1 day
-
histogram: the min/max setting in -T is ignored when -R is setPossibly taken @seisman claimed this 1 day ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
GenericMappingTools/gmt#9330 · 1 reaction ·
Maintainers usually reply within 1 day
All issues in GenericMappingTools/gmt
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Broken links in reference manualPossibly taken @farisbasha claimed this 14 days ago. Opencore:meson
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mpv-player/mpv#18934 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
libsndfile/libsndfile#1239 ·