gmt icon indicating copy to clipboard operation
gmt copied to clipboard

Can't change font and offset of colorbar's Y label

Open seisman opened this issue 2 years ago • 2 comments

Description of the problem

As shown below, MAP_LABLE_OFFSET and FONT_LABEL can control the X label, but have no effects on the Y label.

gmt colorbar -Cseis -Djx0c/0c+h -R0/10/0/10 -JX10c -Bxaf+l"Xaxis" -By+l"Depth" --MAP_LABEL_OFFSET=20p --FONT_LABEL=10p,1 -png map

map

System information

  • GMT version (gmt --version): 6.4.0

seisman avatar Jun 17 '22 02:06 seisman

True. The code shows this:

		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.

PaulWessel avatar Jun 17 '22 10:06 PaulWessel

For reference, the proposed PR makes this plot:

map

PaulWessel avatar Jun 18 '22 14:06 PaulWessel