使用可能な色をレスポンスにマッピングする:JMPに組み込まれているカラーテーマを使用するか、JMPのツールを使用してカスタムマッピングを作成できます。カスタムマッピングを使用するにはJSLを書く必要があります。それはテーマにはなりません。
内蔵テーマを使用する:HeatColor関数は、0から1までの数値を色にマッピングします。この例では、「ジェット」と「スペクトル」という2つのテーマを使用して、次の図を作ります。
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" ); // use right
Text( right justified, {98, .7}, "spectral color interpolation" ); // justification
)
);

HeatColorの詳細: グラフィック機能
内蔵のテーマは素晴らしく、親しみやすく、そして使いやすいですが、違うものが必要になるかもしれません。次の例は、補間のためのJMPの2つの異なる関数、InterpolateとSplineEvalを示しています。どちらにも長所と短所があります。まず、写真のコード:
smooth = 300; // bigger numbers make a stiffer spline
xRange = 0 :: 100; // graph plotted over this range
// greenX,greenY define 5 "control" points for the color; the Y value is the green in RGB
greenX = [0 3 5 7 10] ^ 2; // unevenly spaced points in X: [0 9 25 49 100]
greenY = [0.1 0.4 0.9 0.4 0.1]; // uneven in Y too
// greenCoef is computed once, used a lot in the evaluator
greenCoef = Spline Coef( greenX, greenY, smooth ); // make the coefficients once
greenSpline = Spline Eval( xRange, greenCoef ); //use them here, and below
// greenSpline as a matrix of Ys for each X in the xRange argument
// or...linear piece-wise interpolation (the first argument must be a scalar at this time)
greenLinear = J( 1, N Cols( xRange ), 0 ); // unlike spline, for now at least,
For( i = 1, i <= N Cols( xRange ), i++, // interpolate generates one answer per call
greenLinear[i] = Interpolate( xRange[i], greenX, greenY ); // edgy version of smooth spline
);
// graph the spline and linear colors
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 ); // draw the smooth spline, thick, green
Pen Color( "blue" ); Pen Size( 3 );
Line( xRange, greenLinear ); // draw the pointy linear interpolation, thinner, blue
// next, draw the large black round marker dots...
Marker( Combine States( Color State( "black" ), Marker State( 12 ) ), greenX, greenY );
// draw the horizontal color bars, above and below the graph
Pen Size(1);
For( x = 0, x <= 100, x += .0625, // generate enough short vertical lines to make a
// solid patch of color. set the color of each line by spline...
Pen Color( RGB Color( 0, Spline Eval( x, greenCoef ), .5 ) ); // use the coefficients again
Line( {x, 1.1}, {x, 1.5} ); // color bar above the graph is for spline
Pen Color( RGB Color( 0, Interpolate( x, greenX, greenY ), .5 ) ); // set color by linear
Line( {x, -.1}, {x, -.5} ); // color bar below graph is linear interpolation
);
// label the color bars. Should work OK with reasonable sized fonts...
Text Color( "white" ); // lands on top of the dark part of the color bar
Text( right justified, {98, -.4}, "linear color interpolation" ); // use right
Text( right justified, {98, 1.2}, "spline color interpolation" ); // justification
)
);

写真は緑色のスプライン曲線と青色の線形補間曲線です。両方の曲線は5つの黒のコントロールポイントに対して作成されています。図の上部は、緑色の色成分を緑色のスプライン曲線の値に設定することによって作成された色のバーを示しています。図の下部にも同様の色のバーが表示されていますが、緑色の成分は線形補間によるものです。
あなたはすでに一番下のバーの過度に明るいスポットに気を取られているかもしれません。心配しないでください、それは実際にはありません、それはに関連していますマッハバンド - ウィキペディア、フリー百科事典 。しかし、それはあなたがスプライン補間を好むかもしれない理由です。スプライン補間には、主にアンダーシュートとオーバーシュートに関するさまざまな問題があります。一番上のバーが一番下のバーと同じくらい明るい緑色になることはありません。 そして、この場合に言うのは難しいですが、それは最終的なポイントより下に落ちます。上のJSLの最初の行、smooth = 300は、スプラインの剛性/張力を設定しています。アプリケーションに合った値を選ぶ必要があります。
HeatColorの例では、(おそらくSQRTを使って)0..1引数を変換して色を伸ばすことができます。スプラインと内挿の両方で、必要なだけコントロールポイントを配置することで、代わりに(この例のように)色空間を拡大/縮小することができます。赤と青のチャンネルも追加して、それらに独自のプロファイルを付けることができます。
添付ファイルは記事のコードと同じです。
SplineEvalの詳細: その他の注意事項
補間の詳細: 条件付き関数
古いブログ形式からの変換に耐えられなかったフォーマットとコードの修復について、2017年4月1日更新。