0
votes

I am plotting a NxN square matrix with numbers between [0,1].

Due to the large number of zero, the matrix appears mostly black, but I know, and I can see by squinting my eyes, that there are many more points colored, only rendered in a dark color by the gradient.

I would like to plot using a "discontinuos" gradient, i.e. one that colors the 0 with black and assigns only very bright, high-visibility colors to any other values.

I would be fine with a strongly discrete or range-based gradient i.e. something like:

0 black, (0,0.25) white , (0.25,0.50) yellow, (0.50,0.75) green, (0.75,1] light blue

Is there any way to achieve something similiar?

Here is my current script, of which I have tried some alterations.

#!/bin/gnuplot
#
# Plot heat maps
#


unset key
set tic scale 0


set palette defined (0 "black" , 1 "white", 2 "yellow", 3 "red")
set cbrange [0:1]

unset cbtics

set xrange [1:N]
set yrange [N:1] # Not a typo

set term pdf
set output "mat.pdf"

plot 'mat.out' matrix  with image
1

1 Answers

0
votes

After a little bit more research and experimenting, the traffic light style palette seems to work, proposed here.

Original palette: 'Traffic light' palette (non-smooth color jumps at gray = 1/3 and 2/3).

       set palette model RGB
       set palette defined (0 "dark-green", 1 "green", 1 "yellow", \
                            2 "dark-yellow", 2 "red", 3 "dark-red" )

More jumps:

set palette defined (0 "black", 0 "grey", 1 "white", 1 "yellow", \
                 2 "dark-yellow", 2 "green", 3 "dark-green", \
                 3 "red", 4 "dark-red")