I plot a 2D function using splot with a colour 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
This somehow works; however, I'd like the graph to be black exactly at value 1.0 and coloured appropriately if it diverges from this level. The problem is that the palette is defined relatively to the range of min:max values contained in the plot and not to absolute values. The zrange option doesn't seem to affect this behaviour. Is there a way to create the absolute mapping?
The color range 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 symmetric to 1.0, you can use the stats command to determine the color range 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]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With