NV5 GEOSPATIAL SOFTWARE
>  Docs Center  >  Libraries  >  JHU/APL/S1R  >  NICENUMBER

NICENUMBER

NICENUMBER

## Purpose

Find a nice number close to the given number.

## Calling Sequence

n = nicenumber(x)

## Inputs

x = given number. in

## Keywords

/FLOOR finds next nice number le to X.
/CEIL finds the next nice number ge to X.
MINOR=m Returned suggested minor tick spacing.
/NO25 Means do not allow multiples of 2.5

## Outputs

n = nice number close to x. out
1, 2, 2.5, or 5 scaled to size of x.

## Notes

Default operation is useful for finding tick spacings:
dx = nicenumber((xmx-xmn)/nticks).
/FLOOR and /CEIL are useful for scaling data plots:
xmn = nicenumber(min(x),/floor)
xmx = nicenumber(max(x),/ceil)
plot, x, y, xrange=[xmn,xmx], . . .
/floor and /ceil may not give values related to the
step size, dx. The following method will:
ceil(t/dx)*dx is a multiple of dx on the high side of t.
floor(t/dx)*dx is a multiple of dx on the low side of t.

## Modification History

R. Sterner, 6 Feb, 1990
R. Sterner, 27 Jan, 1993 --- dropped reference to array.
R. Sterner, 12 Feb, 1993 --- returned 1 element array as a scalar.
R. Sterner, 2003 Mar 11 --- Added /NO25.
R. Sterner, 2010 May 23 --- Converted arrays from () to [].
Copyright (C) 1990, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.

© 2024 NV5 Geospatial Solutions, Inc. |  Legal