Mapping available colors onto a response: you can use a color theme built in to JMP, or you can build a custom mapping with tools in JMP. You'll have to write JSL to use a custom mapping; it won't be a theme.
Using a built in theme: the HeatColor function maps a number between zero and one into a color. This example uses two themes, "jet" and "spectral", and makes the following picture.
New Window( "Example", Graph Box( Y Scale( -0.6, 1.6 ), X Scale( -5, 105 ),
framesize( 700, 300 ), Marker Size( 6 ), suppressAxes,
For( x = 0, x <= 100, x += .0625,
Pen Color( Heat Color( x / 100, "jet" ) );
Line( {x, 0}, {x, .5} );
Pen Color( Heat Color( x / 100, "spectral" ) );
Line( {x, .6}, {x, 1.1} );
);
Text Color( "black" );
Text( right justified, {98, .1}, "jet color interpolation" );
Text( right justified, {98, .7}, "spectral color interpolation" );
)
);

more on HeatColor: Graphic Functions
The built in themes are nice and friendly and easy to use, but you might need something different. The following example demonstrates two different functions in JMP for interpolation: Interpolate and SplineEval. Both have pros and cons. First, the code for the picture:
smooth = 300;
xRange = 0 :: 100;
greenX = [0 3 5 7 10] ^ 2;
greenY = [0.1 0.4 0.9 0.4 0.1];
greenCoef = Spline Coef( greenX, greenY, smooth );
greenSpline = Spline Eval( xRange, greenCoef );
greenLinear = J( 1, N Cols( xRange ), 0 );
For( i = 1, i <= N Cols( xRange ), i++,
greenLinear[i] = Interpolate( xRange[i], greenX, greenY );
);
New Window( "Example", Graph Box( Y Scale( -0.6, 1.6 ), X Scale( -5, 105 ),
framesize( 700, 300 ), Marker Size( 6 ), suppressAxes,
Pen Color( "green" ); Pen Size( 5 );
Line( xRange, greenSpline );
Pen Color( "blue" ); Pen Size( 3 );
Line( xRange, greenLinear );
Marker( Combine States( Color State( "black" ), Marker State( 12 ) ), greenX, greenY );
Pen Size(1);
For( x = 0, x <= 100, x += .0625,
Pen Color( RGB Color( 0, Spline Eval( x, greenCoef ), .5 ) );
Line( {x, 1.1}, {x, 1.5} );
Pen Color( RGB Color( 0, Interpolate( x, greenX, greenY ), .5 ) );
Line( {x, -.1}, {x, -.5} );
);
Text Color( "white" );
Text( right justified, {98, -.4}, "linear color interpolation" );
Text( right justified, {98, 1.2}, "spline color interpolation" );
)
);

The picture shows a green spline curve and a blue linear interpolation curve. Both curves are built for the 5 black control points. The top of the picture shows a bar of color made by setting the green color component to the green spline curve value. The bottom of the picture shows a similar bar of color, but the green component comes from the linear interpolation.
You might have already been distracted by an overly-bright spot in the bottom bar. Don't worry, it isn't really there, it is related to Mach bands - Wikipedia, the free encyclopedia . But it is a reason you might prefer the spline interpolation. The spline interpolation has different issues, mostly around under- and over-shoot. The top bar never gets quite as bright green as the bottom bar. And it is hard to tell in this case, but it dips below the final point too. The first line in the JSL above, smooth=300, is setting the stiffness/tension of the spline. You'll have to pick a value that works for your application.
In the HeatColor example, you could transform the 0..1 argument (with SQRT perhaps) to stretch the colors. With both spline and interpolate you can stretch/squish the color space instead (as this example did) by putting in as many control points as you need. You can add the red and blue channels too, and give them their own profiles.
The files attached are the same as the code in the post.
more on SplineEval: Additional Notes
more on Interpolate: Conditional Functions
Updated 4Jan2017 for formatting and code repair that didn't survive the conversion from the old blog format.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.