Last modified: 12 December 2018

How do I change the format of the axis ticklabels?

The format used to display the ticklabels is controlled by the tickformat attribute of the axis. Please see the How do I change the appearance/location of the axis ticklabels? entry for information on how to change the other properties of ticklabels.

The default setting for this attribute is '%g', which covers many cases. It supports a C-style syntax for controlling the format, so '%.2f' will force two decimal places at each label, but there are a number of plot-specific options as described in the Tick Format section of ahelp chipsopt.

The following set of commands use sexagesimal notation for the axes (examples are included in the ChIPS Image Gallery)

chips> clear()
chips> add_image("img.fits")
chips> set_xaxis(["tickformat", "%ra"])
chips> set_yaxis(["tickformat", "%dec"])

and the following creates:

[The y axis ticklabels are displayed in exponential notation and the x axis ones with one decimal point]
chips> clear()
chips> add_curve([1,2,3], [1e5, 1e6, 2e7])
chips> log_scale(Y_AXIS)
chips> set_yaxis(["tickformat", "%0.0z"])
chips> set_xaxis(["tickformat", "%.1f"])
chips> set_axis(["ticklabel.size", 18])


The ChIPS GUI makes it easy to modify a visualization using your mouse, rather than Python functions. The GUI can also be used to add annotations - such as labels, lines, points and regions - and to zoom or pan into plots.