I am using gnuplot to plot a matrix with the following commands:
ub = 1
lb = -ub
set cbrange [lb:ub]
set palette defined (lb "red", 0 "white", ub "blue)
plot 'mydata.dat' matrix ind 19 with image
This gives me a matrix which looks great. But I also want a figure that contains only the points with value in domain (0.8:1) and (-1:-0.8). I think I probability can change the cbrange or change the palette definition. But I have no idea how. Can anyone show me how to do it (either way)? Thanks.
In general, the numerical value given to set palette defined
do not define absolute values, but are used only for the gradient computation and are mapped to [0, 1]
. That means that e.g.
set palette defined (-1 "red", 0 "white", 1 "blue")
and
set palette defined (100 "red", 200 "white", 300 "blue")
are completely equivalent. The range choosen with set cbrange
is then mapped to this unity interval.
So, to show only the range [0.8:1]
, all in the same blue-shaded like in the complete plot, you can check and limit the value of the third, the color column:
set palette defined (-1 "red", 0 "white", 1 "blue)
ub = 1
lb = -ub
set cbrange [lb:ub]
plot 'mydata.dat' matrix using 1:2:($3 >= 0.8*ub ? $3 : 0) ind 19 with image
This would set all values lower than 0.8*ub
to 0
, and show only the values above 0.8*up
in blue.
If you would set the color range to [0.8:1]
, the values 0.8
would be shown in red, and 1
in blue.
Accordingly, to show only the range [-1:-0.8]
, use
plot 'mydata.dat' matrix using 1:2:($3 <= 0.8*lb ? $3 : 0) ind 19 with image