Hi. I am trying to make a plot with custom primary and secondary X axis annotations. What I get is custom secondary annotations overwrite the primary ones:
I think this looks like a bug, otherwise would be grateful for help to solve this.
Custom primary X annotations are plotted correctly alone:
My code below:
cat << EOF >| x_sannots.txt
0 ig A
40 ig B
80 ig
EOF
cat << EOF > x_pannots.txt
0 ig 1
10 ig 2
20 ig 3
30 ig 4
40 ig 1
50 ig 2
60 ig 3
70 ig 4
80 ig
EOF
# this gets secondary annotations plotted twice, primary annotation content gets overwritten:
gmt basemap -R0/80/0/10 -JX6c/6c -Byaf -Bpxcx_pannots.txt -Bsxcx_sannots.txt -png quick
# primary annotations plotted correctly if secondary aren't specified
gmt basemap -R0/80/0/10 -JX6c/6c -Byaf -Bpxcx_pannots.txt -png quick1
I actually want somehting like below this, except the intervals and custom labels are not regular and need to be computed and assigned externally, this is why I decided to try GMT with custom axis annotations. The plot below is manually edited using Gimp. It is supposed to be a graphical representation of replicate measurement series within several different experiments for visual data quality control.
an obvious (and overlooked) workaround was to use two basemap calls. First basemap call plotted primary annotations, and then second call needed for the secondary annotations:
gmt begin quick3 png
gmt basemap -R0/80/0/10 -JX6c/6c -Byaf -Bpxcx_pannots.txt
gmt basemap -BS -Bsxcx_sannots.txt
gmt end show
Hmm, the CookBook example does it all in a single call.
Edit: Sorry, hadn’t noticed that you have two custom-axis calls.
I tested the cookbook example and it works just fine.
The difference is that I tried to put two custom annotation sets per axis: custom primary and custom secondary annotations all on the same X axis. That did not work: secondary annotation labels were plotted twice instead. The cookbook example specified an interval as primary X annotations and custom secondary X annotations, plus custom primary Y annotations - one custom annotation set per axis. That works fine.
Right, exactly as you noticed!
PS
The most disturbing is that gmt becomes so painfully inefficient this way. Most Cartesian plotting I’ve been doing has been simple and it has always been my admiration of (and advantage) being able to cover all such needs with just a one-liner in gmt. Once a second basemap (or whatever) call needs to be added, it’s suddenly +3 lines of code in modern mode and I’m writing a whole script, far away from a gmt one-liner in bash. However, plot scripting is a completely different territory with lots of tools to choose from (gnuplot, python+matplotlib, R etc).