Class WStandardColorMap

public class WStandardColorMap extends WAbstractColorMap
Standard colorMap.

The WStandardColorMap is defined by a list of value-to-color pairs. The WStandardColorMap has two modes: a continuous mode, in which the colors are linearly interpolated in between the pair values, and a non-continuous mode, where the values are not interpolated, so that the colormap has a banded effect. In non-continuous mode, the color of a given point P is the color of the pair with the largest value smaller than P.

Numerical values above the maximum value in the list map to the maximum value's color, all values below the minimum value in the list map to the minimum value's color. The range indicated by the minimum and maximum passed to the constructor determines which part of the colormap is drawn by createStrip() or paintLegend().

The figure below illustrates the possible colormaps that can be constructed from the list {"0.0 - StandardColor::DarkRed", "1.0 - StandardColor::Red", "2.0 - StandardColor::Gray"}. The discrete map (on the left) has the range [0, 3], the continuous map (on the right) has the range [0, 2]. The utility method discretise() is also applied to the continuous colormap to obtain a colormap with 5 bands in the same range.

Different uses of WStandardColorMap

  • Constructor Details

    • WStandardColorMap

      public WStandardColorMap(double min, double max, boolean continuous)
      Construct a default colormap.

      The default colormap is a transition from yellow to red. The color-scheme was taken from ColorBrewer, which contains lots of useful info and example schemes you might want to use for your custom colormaps.

    • WStandardColorMap

      public WStandardColorMap(double min, double max, List<WStandardColorMap.Pair> colors, boolean continuous)
      Construct a custom colormap.

      This constructor allows you to pass a list of value-to-color pairs that define a colormap as described in the class description.

  • Method Details