# Class ScaleType

java.lang.Object
uk.ac.starlink.ttools.plot2.ScaleType

public abstract class ScaleType extends Object
Defines a type of axis scaling. A ScaleType is factory for `Scale` instances.

Since:
  20 Mar 2025
Author:
  Mark Taylor

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`ScaleType.Param`
Defines a numerical parameter for a ScaleType.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final ScaleType`
`ASINH`
Scale type using inverse hyperbolic sin scaling.
`static final ScaleType`
`LINEAR`
Linear scale type, no parameters.
`static final ScaleType`
`LOG`
Logarithmic scale type, no parameters.
`static final ScaleType`
`SYMLOG`
Scale type using so-called symmetric log scaling.
`static final ScaleType`
`TIME`
Time scale type, linear but with a custom rounding.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`ScaleType(String scaleName, ScaleType.Param[] params)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`abstract Scale`
`createScale(double[] paramValues)`
Constructs a scale.
`static ScaleType`
`fromName(String name)`
Returns a ScaleType instance with the given name.
`abstract String`
`getDescription()`
Returns an XML description of this scale type.
`static ScaleType[]`
`getInstances()`
Returns a list of the general-purpose instances of this class.
`String`
`getName()`
Returns the name of this type.
`ScaleType.Param[]`
`getParams()`
Returns the ordered list of parameter definitions that must be supplied for scales produced by this type.
`String`
`toString()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### LINEAR

public static final ScaleType LINEAR
Linear scale type, no parameters.

### LOG

public static final ScaleType LOG
Logarithmic scale type, no parameters.

### SYMLOG

public static final ScaleType SYMLOG
Scale type using so-called symmetric log scaling. It can represent a wide dynamic range of values including negative ones. This idea is copied from Matplotlib's symlog scale. The region around the origin is linear, but outside that region values are scaled logarithmically, or negative logarithmically below zero.

Scales have two parameters which must both be >0:

- `linthresh`: defines the linear region (-linthresh..linthresh)
- `linscale`: ratio of graphical extent of the region (0,linthresh) to a decade in the logarithmic region

The function's derivatives are in general discontinuous at +/-`linthresh`

### ASINH

public static final ScaleType ASINH
Scale type using inverse hyperbolic sin scaling. The scaling function is `x -> asinh(x/a)`. This function is asymptotically linear near the origin, and asymptotically logarithmic (or negative logarithmic) far from the origin. The "linear width" parameter `a`, which must be >0, defines the extent of the quasi-linear region.

### TIME

public static final ScaleType TIME
Time scale type, linear but with a custom rounding.

## Constructor Details

### ScaleType

protected ScaleType(String scaleName, ScaleType.Param[] params)
Constructor.

Parameters:
  `scaleName` - short name for the scale type
  `params` - numeric parameters of this scale type

## Method Details

### createScale

public abstract Scale createScale(double[] paramValues)
Constructs a scale. The supplied parameter values must match those defined by the result of the {#getParams} method. Missing later values are permitted, and will be set to the default value of the relevant parameter.

Parameters:
  `paramValues` - numeric arguments for this scale
Returns:
  new scale
Throws:
  `IllegalArgumentException` - if the values are not acceptable

### getParams

public ScaleType.Param[] getParams()
Returns the ordered list of parameter definitions that must be supplied for scales produced by this type. This may be an empty array if the scale type is not parameterised.

Returns:
  scale parameter specifications

### getName

public String getName()
Returns the name of this type.

Returns:
  type name

### getDescription

public abstract String getDescription()
Returns an XML description of this scale type.

Returns:
  description in XML-friendly text, but not wrapped in any element

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### getInstances

public static ScaleType[] getInstances()
Returns a list of the general-purpose instances of this class.

Returns:
  instance list

### fromName

public static ScaleType fromName(String name)
Returns a ScaleType instance with the given name. This is the inverse of the `getName()` method.

Parameters:
  `name` - name of the scale type
Returns:
  scale type matching the given name, or null