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
{{ message }}
Repository navigation
Can't change font and offset of colorbar's Y label #6799
if (label[0]) { /* Add label */
form = gmt_setfont (GMT, &GMT->current.setting.font_label);
gmt_map_text (GMT, xleft + 0.5 * length, y_label, &GMT->current.setting.font_label, label, 0.0, Label_justify, form);
}
if (unit[0]) { /* Add unit label */
form = gmt_setfont (GMT, &GMT->current.setting.font_annot[GMT_PRIMARY]);
So the y-label uses the annotation font as you show. I cannot see anything in the documentation that says this is how it is supposed to work, so I think we can declare a bug and change this to FONT_LABEL. Agreed? It is possible this will require updated PS files for those cases with y-labels on color bars.
I think this was already fixed so I will close it.
For the record, -By+l"..." is the colorbar unit, not a label — use FONT_ANNOT_SECONDARY / MAP_ANNOT_OFFSET_SECONDARY for it, not FONT_LABEL / MAP_LABEL_OFFSET (that only affects -Bxaf+l"...").
gmt begin test_6799 png
gmt set FONT_LABEL 10p,1 MAP_LABEL_OFFSET 10p
gmt set FONT_ANNOT_SECONDARY 12p,1 MAP_ANNOT_OFFSET_SECONDARY 20p
gmt colorbar -Cseis -Dx0c/0c+w7c+h -R0/10/0/10 -JX10c -Bxaf+l"Xaxis" -By+l"Depth"
gmt end
Activity
PaulWessel commentedon Jun 17, 2022
True. The code shows this:
So the y-label uses the annotation font as you show. I cannot see anything in the documentation that says this is how it is supposed to work, so I think we can declare a bug and change this to FONT_LABEL. Agreed? It is possible this will require updated PS files for those cases with y-labels on color bars.
PaulWessel commentedon Jun 18, 2022
For reference, the proposed PR makes this plot:
Esteban82 commentedon Aug 20, 2026
I think this was already fixed so I will close it.
For the record,
-By+l"..."is the colorbar unit, not a label — useFONT_ANNOT_SECONDARY / MAP_ANNOT_OFFSET_SECONDARYfor it, notFONT_LABEL / MAP_LABEL_OFFSET(that only affects-Bxaf+l"...").