Scale an array preserving order to a discrete or continuous scale