@ClusteredMining chiesto Creazione di una mappa termica: come definisco i valori per ciascun colore nel gradiente?. Questa non è esattamente la risposta alla domanda, ma forse. Usando la GradientFunction e una lista di colori, è possibile ottenere un bordo veramente netto in un terzo colore. Sono possibili molte variazioni personalizzando un lungo elenco di colori per produrre confini netti. O sfocato, che potrebbe sembrare più carino.
La GradientFunction necessita di un po' di JSL che possa rispondere alla domanda " qual è il valore Z qui? " Tale funzione potrebbe non essere immediatamente disponibile perché i dati sono in una tabella e non ben disposti in una griglia.
modifica: probabilmente dovresti rendere totalWidth più grande anziché più piccola; controlla il numero di colori nella colorList che controlla la precisione del posizionamento del bordo. Probabilmente dovresti rendere anche il valore della griglia un po' più grande. grid=100 e totalWidth=100 sembrano più ragionevoli di 50 e 10.
// these are in units of the Z value
range = {100, 400}; // the range of the color list; the formula a*b on the axis 10..20 makes these numbers
targetValue = 200; // happens to go through the corners for this example.
// grid: this determines how many points are evaluated by GradientFunction
grid = 50; // subdivisions, more looks smoother, is slower. typically 50 to 500. 667 may be a limit.
// how many colors in the colorList
thick = 0.050; // thickness of division line, can be 0. 50% is really fat (0.5)
totalWidth = 10; // make this smaller for a blurred edge, maybe 10 or 100 instead of 1000, which has a sharper edge
targetWidth = Round( thick * totalWidth );// making the green target about 10%, so kind of thick
otherwidth = totalWidth - targetWidth; // the ratios, below, divides this in parts
lowRatio = (targetValue - range[1]) / (range[2] - range[1]);// the red
highRatio = 1 - lowRatio;// the blue
// this list is a bunch of repeated reds, a few greens, and a
// bunch of blues. The greens are centered at the targetValue.
colorList = {};
Insert Into( colorList, As List( Repeat( RGB Color( .4, 0, 0 ), Round( otherwidth * lowRatio ) ) ) );
Insert Into( colorList, As List( Repeat( RGB Color( 0, .6, 0 ), targetWidth ) ) );
Insert Into( colorList, As List( Repeat( RGB Color( 0, 0, .4 ), Round( otherwidth * highRatio ) ) ) );
New Window( "target=" || Char( targetValue ),
g = Graph Box(
X Scale( 10, 20 ),
Y Scale( 10, 20 ),
framesize( 600, 400 ),
Gradient Function(
a * b,
a,
b,
Matrix( range ), // range to map the colors onto
Z Color( colorList ),
<<XGRID></XGRID>
Gioca con griglia, larghezza e spessore totale per ottenere grafici interessanti:
A thin sharply defined green region between red and blue.A thin sharply defined green region between red and blue.A thin sharply defined green region between red and blue.A thin sharply defined green region between red and blue.A thin sharply defined green region between red and blue.Una sottile regione verde ben definita tra il rosso e il blu.
Thicker, and still sharp.Thicker, and still sharp.Thicker, and still sharp.Thicker, and still sharp.Thicker, and still sharp.Più spesso e ancora tagliente.
Thicker, and blurry.Thicker, and blurry.Thicker, and blurry.Thicker, and blurry.Thicker, and blurry.Più spesso e sfocato.