NumberColormap

Describes a mapping of floating-point value to colors.

Continuous

A continuous colormap linearly samples a color gradient within a defined range.

A value X% of way between min and max should use the color from X% way down gradient. When that X doesn't land directly on a color use the average of the colors on either side, inverse-weighted by the distance to each.

Values below the minimum use the first color in the gradient array. Values above the maximum use the last.

Diagram of a continuous colormap

Fields

type
"Continuous"
gradient: Array
Array with Gradient type storing the smooth color gradient.
range: NumberRange
Value range.

Discrete

A discrete colormap divides the number line into adjacent but non-overlapping ranges and gives a flat color to each range.

Values above the last boundary use end_color.

Fields

type
"Discrete"
boundaries: Array
Array with Boundary type storing the smooth color gradient, containing the value and inclusiveness of each boundary. Values must increase along the array. Boundary values type should match the type of the number array.
gradient: Array
Array with Gradient type storing the colors of the discrete ranges. Length must be one more than boundaries, with the extra color used for values above the last boundary.

Schema

{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "gradient",
        "range",
        "type"
      ],
      "properties": {
        "gradient": {
          "$ref": "#/definitions/Array"
        },
        "range": {
          "$ref": "#/definitions/NumberRange"
        },
        "type": {
          "type": "string",
          "enum": [
            "Continuous"
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "boundaries",
        "gradient",
        "type"
      ],
      "properties": {
        "boundaries": {
          "$ref": "#/definitions/Array"
        },
        "gradient": {
          "$ref": "#/definitions/Array"
        },
        "type": {
          "type": "string",
          "enum": [
            "Discrete"
          ]
        }
      }
    }
  ]
}