Class ColorMapCSS.Gradient2D
- Enclosing class:
ColorMapCSS
-
Nested Class Summary
Nested classes/interfaces inherited from class ColorMap
ColorMap.Gradient<T>, ColorMap.Gradient1D<T>, ColorMap.Gradient2D<T>, ColorMap.GradientND<T>, ColorMap.Hue<T>, ColorMap.Index<T>
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionGradient2D
(Color[] colors, int nIncr) Construct two dimensional color gradient to represent two dimensional data values.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.Gradient2D
(Color trait1, Color trait2, int nIncr) Construct two dimensional color gradient to represent two dimensional data values.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. -
Method Summary
Modifier and TypeMethodDescriptioncolor2Color
(Color color) Utility method to convert thecolor
into a color object of typeT
.Methods inherited from class ColorMap.Gradient2D
binOf, binOf, setColor, setColor, setRange, setRange, setRange, setRange, translate, translate, translate, translate
Methods inherited from class ColorMap.Gradient
interpolateColors, interpolateColors, translate
Methods inherited from class ColorMap
addAlpha, addAlpha, addColors, blendColors, blendColors, translate, translate
-
Constructor Details
-
Gradient2D
Construct two dimensional color gradient to represent two dimensional data values. The first dimension spans colors ranging from black tocolors[0]
and the second dimension from black tocolors[1]
. Each dimension is interpolated withsteps-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 dimensionnIncr
- the number of intermediate colors per dimension- See Also:
-
Gradient2D
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 simplexSN
.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 fromcolors[idx]
tocolors[0]
and fromcolors[idx]
tocolors[1]
in the second dimension, assuming thatidx=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 dimensionsidx
- the index of the dependent traitnIncr
- the number of intermediate colors per dimension- See Also:
-
Gradient2D
Construct two dimensional color gradient to represent two dimensional data values. The first dimension spans colors ranging from black tocolors[0]
and the second dimension from black tocolors[1]
. Each dimension is interpolated withsteps-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 traittrait2
- the color representing the second traitnIncr
- the number of intermediate colors per dimension- See Also:
-
Gradient2D
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
totrait1
and frombg
totrait2
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 traittrait2
- the color representing the second traitbg
- the color representing the background (or a third, dependent trait)nIncr
- the number of intermediate colors per dimension- See Also:
-
-
Method Details
-
color2Color
Description copied from class:ColorMap
Utility method to convert thecolor
into a color object of typeT
.- Specified by:
color2Color
in classColorMap<String>
- Parameters:
color
- the color to convert- Returns:
- the color represented as an object of type
T
-