Chandra X-Ray Observatory
Skip to the navigation links
Last modified: 13 April 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.

Last modified: 13 April 2018
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.