Chandra X-Ray Observatory
Skip to the navigation links
Last modified: 14 December 2016

Why do my plots sometimes have padding around them?

The preference field axis.pad controls how much space is added by an axis when the AUTO setting is used for either the lower or upper limit. If is given as a fraction of the data range along the axis; the default is 0.05 which means that if the data covers x=10 to 20 then the padding will be 0.5 for a linear scale and 0.05 * log10(2) for a logarithmic scale.

When explicit limits are given the padding is ignored, which means that in the following the final limits only use the padding for the maximum-displayed value of the X axis (but note how the padding has changed to account for the new X axis "data range" of -10 to 200 rather than 10 to 200):

chips> clear()
chips> add_curve([10,20,50, 200], [1, 2, 5, 10])
chips> get_plot_range()
       [0.5, 209.5, 0.55000000000000004, 10.449999999999999]
chips> limits(X_AXIS, -10, AUTO)
chips> limits(Y_AXIS, 0, 11)
chips> get_plot_range()
       [-10.0, 210.5, 0.0, 11.0]

If you still want the benefits of the AUTO setting - namely automatic rescaling when new data is added - but do not want the extra padding then either change the preference setting or override the current value with:

chips> set_preference("axis.pad", "0")
chips> set_axis(["pad", 0])

The first version will use no padding for any new plots created, but will not change any existing plots, whereas the second value only changes the current plot.

Last modified: 14 December 2016
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.