Gnuplot: setting palette colors for absolute values

I am drawing a 2D function using splot

with a color palette:

set zrange [0.5:1.5] 
set palette defined ( 0 "green", 1 "black", 2 "red" )
splot "HTSG_PeakPositions_thetaI080.gnuplot" using 3:1:5 title 'Relative Peak Positions' with pm3d

      

It somehow works; however, I would like the graph to be black exactly at 1.0 and color appropriately if it deviated from that level. The problem is that the palette is defined relative to the range of min: max values ​​contained in the graph, not absolute values. The option zrange

doesn't seem to affect this behavior. Is there a way to create an absolute display?

+3


source to share


1 answer


The range of colors is affected by set cbrange

:

set cbrange [0.5:1.5]
set palette defined ( 0 "green", 1 "black", 2 "red" )
splot "HTSG_PeakPositions_thetaI080.gnuplot" using 3:1:5 title 'Relative Peak Positions' with pm3d

      



If you want some kind of autoscaling to be symmetrical down to 1.0, you can use the command stats

to define a range of colors before plotting:

stats "HTSG_PeakPositions_thetaI080.gnuplot" using 5 nooutput
cb_val = (abs(STATS_min - 1) < abs(STATS_max - 1) ? abs(STATS_max - 1) : abs(STATS_min - 1))
set cbrange [1 - cb_val : 1 + cb_val]

      

+3


source







All Articles