0

I have a heat map plot in MATLAB. However, the default text label on every box has the same font colour. This reduces readability.

How can I come up (MATLAB code/concept) with an adaptive font colouring scheme that reads the colour value of each box in the heat map, and automatically chooses a font colour that contrasts with the background?

I am happy to move to gnuplot/ggplot2/pgfplots/matplotlib if so required to achieve this

  • See the [Programmatically choose high-contrast colors](https://stackoverflow.com/questions/407793/programmatically-choose-high-contrast-colors) – Andrei Davydov Jun 16 '17 at 10:37
  • There's an example of that here for grayscale data: [How do I visualize a matrix with colors and values displayed?](https://stackoverflow.com/q/3942892/52738) If you have color data, you could convert to grayscale (such as with `rgb2gray`) and apply the calculations there. – gnovice Jun 16 '17 at 15:50

0 Answers0