Class ColorMapCSS.Gradient2D

Enclosing class:
ColorMapCSS

public static class ColorMapCSS.Gradient2D extends ColorMap.Gradient2D<String>
Two dimensional color gradient with one color for each dimension.
  • Constructor Details

    • Gradient2D

      public Gradient2D(Color[] colors, int nIncr)
      Construct two dimensional color gradient to represent two dimensional data values. The first dimension spans colors ranging from black to colors[0] and the second dimension from black to colors[1]. Each dimension is interpolated with steps-1 intermediate colors. The resulting gradient spans (steps+1)2 colors.

      The default range for mapping data values onto the color gradient is [0.0, 1.0] in both dimensions.

      Parameters:
      colors - the two colors for each dimension
      nIncr - the number of intermediate colors per dimension
      See Also:
    • Gradient2D

      public Gradient2D(Color[] colors, int idx, int nIncr)
      Construct two dimensional color gradient to represent three dimensional data values where one data value is dependent on the other two. This applies, for example, to data based on the replicator equation and dynamics that unfold on the simplex SN.

      The index of the dependent trait is idx. It is at its maximum if both other traits are at their minimum. Thus, the color gradient in the first dimension ranges from colors[idx] to colors[0] and from colors[idx] to colors[1] in the second dimension, assuming that idx=2 for the above illustration.

      Each dimension is interpolated with steps-1 intermediate colors. The resulting gradient spans (steps+1)2 colors.

      The default range for mapping data values onto the color gradient is [0.0, 1.0] in all dimensions.

      Parameters:
      colors - the colors for the three dimensions
      idx - the index of the dependent trait
      nIncr - the number of intermediate colors per dimension
      See Also:
    • Gradient2D

      public Gradient2D(Color trait1, Color trait2, int nIncr)
      Construct two dimensional color gradient to represent two dimensional data values. The first dimension spans colors ranging from black to colors[0] and the second dimension from black to colors[1]. Each dimension is interpolated with steps-1 intermediate colors. The resulting gradient spans (steps+1)2 colors.

      The default range for mapping data values onto the color gradient is [0.0, 1.0] in both dimensions.

      Parameters:
      trait1 - the color representing the first trait
      trait2 - the color representing the second trait
      nIncr - the number of intermediate colors per dimension
      See Also:
    • Gradient2D

      public Gradient2D(Color trait1, Color trait2, Color bg, int nIncr)
      Construct two dimensional color gradient to represent two dimensional data with a background color other than black, or, to represent three dimensional data values where one data value is dependent on the other two.

      The color gradient in the first dimension ranges from bg to trait1 and from bg to trait2 in the second dimension.

      Each dimension is interpolated with steps-1 intermediate colors. The resulting gradient spans (steps+1)2 colors.

      The default range for mapping data values onto the color gradient is [0.0, 1.0] in both (all) dimensions.

      Parameters:
      trait1 - the color representing the first trait
      trait2 - the color representing the second trait
      bg - the color representing the background (or a third, dependent trait)
      nIncr - the number of intermediate colors per dimension
      See Also:
  • Method Details

    • color2Color

      public String color2Color(Color color)
      Description copied from class: ColorMap
      Utility method to convert the color into a color object of type T.
      Specified by:
      color2Color in class ColorMap<String>
      Parameters:
      color - the color to convert
      Returns:
      the color represented as an object of type T