@ClusteredMining demandé Création d'une carte thermique - Comment définir les valeurs de chaque couleur du dégradé ?. Cela ne répond pas exactement à la question, mais peut-être. En utilisant GradientFunction et une liste de couleurs, il est possible d'obtenir une limite vraiment nette dans une troisième couleur. De nombreuses variations sont possibles en adaptant une longue liste de couleurs pour produire des limites nettes. Ou flou, ce qui peut sembler plus joli.
La GradientFunction a besoin d'un peu de JSL qui peut répondre à la question " quelle est la valeur Z ici? " Cette fonction peut ne pas être facilement disponible car les données sont dans une table et ne sont pas bien maillées.
edit : vous devriez probablement rendre totalWidth plus grand plutôt que plus petit ; il contrôle le nombre de couleurs dans la colorList qui contrôle la précision du placement des bords. Vous devriez probablement rendre la valeur de la grille un peu plus grande aussi. grid=100 et totalWidth=100 semble plus raisonnable que 50 et 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>
Jouez avec grid, width et totalThick pour obtenir des graphiques intéressants :
A thin sharply defined green region between red and blue.Une fine région verte bien définie entre le rouge et le bleu.
Thicker, and still sharp.Plus épais et toujours pointu.
Thicker, and blurry.Plus épais et flou.