You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
makecpt -F+c can produce a categorical CPT, but when plotting the colorbar, the annotations look weird. See the example below. Why the annotations are "0-1", "1-2", and "2-3". Should they be "0", "1", and "2", no?
gmt begin map png
gmt basemap -R0/10/0/10 -JX4c -Baf -BWSen
gmt makecpt -Ccubhelix -T0/3/1 -F+c
gmt colorbar
gmt end show
When colorbar plots a categorical CPT and no -B is given then it will center the annotations on each unique color and it will use as label whatever is given in the CPT (after the ; label marker per record) or, if no such labels, create one from the boundaries, i.e., 0-1, 1-2, 2-3 in your case. If I manually fix your cpt to look like this:
0 24/45.5/72.5 L ;0
1 159.5/121/72.5 L ;1
2 194/215.5/242 B ;2
then I get what you would prefer. Given this behavior is very long-lived and often reasonable, we could consider other schemes to simplify setting these labels. Here are some thoughts/suggestions for makecpt:
Let -F+c[label] take an optional modifier argument to +c that will do the following, depending on label:
If label is an integer, say 0, then we auto-add labels 0, 1, 2, ...
If label is a letter (say g or G), we auto-add labels g, h, i or G, H, I
If any of the above is followed by a hyphen, then we instead set labels as 0-1, 1-2, G-H, g-h, etc.
If label contains a comma then we will use the comma-separated items as verbatim labels, until we run out, e.g.,
gmt makecpt -Ccubhelix -T0/3/1 -F+c Clouds,Trees,Water
0 24/45.5/72.5 L ;Clouds
1 159.5/121/72.5 L ;Trees
2 194/215.5/242 B ;Water
Activity
PaulWessel commentedon Oct 27, 2020
Hm, see colorbar -Li. Seems to be doing that.
seisman commentedon Oct 27, 2020
colorbar -Lidoesn't change anything.seisman commentedon Oct 27, 2020
BTW, the categorical CPT looks correct:
PaulWessel commentedon Oct 27, 2020
When colorbar plots a categorical CPT and no -B is given then it will center the annotations on each unique color and it will use as label whatever is given in the CPT (after the ; label marker per record) or, if no such labels, create one from the boundaries, i.e., 0-1, 1-2, 2-3 in your case. If I manually fix your cpt to look like this:
0 24/45.5/72.5 L ;0
1 159.5/121/72.5 L ;1
2 194/215.5/242 B ;2
then I get what you would prefer. Given this behavior is very long-lived and often reasonable, we could consider other schemes to simplify setting these labels. Here are some thoughts/suggestions for makecpt:
Let -F+c[label] take an optional modifier argument to +c that will do the following, depending on label:
I think this is a splendid proposal no?
PaulWessel commentedon Oct 27, 2020
I think this possibility is a good improvement. Let me know if you agree, @joa-quim and @seisman.
joa-quim commentedon Oct 27, 2020
Agree. Nice adding
This is something we won't get easier on Julia and cousins.