conditional text color?

Allin Cottrell via gnuplot-beta <[email protected]> Mon, 23 Mar 2026 11:57:40 -0400 (EDT)
Newsgroups gmane.comp.graphics.gnuplot.devel
Message-ID <[email protected]>
I have a gnuplot routine that shows a correlation matrix as a heat 
map. If the dimension of the matrix is not too great it prints the 
value of the correlation coefficient in each "cell". Mostly this 
works fine, but if the color of the cell is a relatively dark blue 
(indicating a strong negative correlation) the default black text is 
not very legible. So I'd like to make the textcolor conditional.

At present I have this plot statement:

plot $data matrix with image, $data matrix using \
  1:2:(sprintf("%.1f",$3)) with labels

I'd like to append something like

tc $3 < -0.6 ? rgbcolor "white" : rgbcolor "black"

That doesn't work ("colorspec option not recognized", not very 
surprisingly). But is there a way to do this?

Thanks for any guidance.

-- 
Allin Cottrell
Professor Emeritus
Wake Forest University


_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta