When creating a data visualisation, one the worst ways to encode the differences between values is to use changes in colour. Whether going from light to dark or changing between two colours, our brains are not particularly good at determining how big the difference is and for small differences, we may not notice it at all.
But for certain data visualisations like heat maps and graphs where length, position and size attributes are already being used, there are no other options. Fortunately people like Cynthia Brewer have done the science needed to minimise the potential errors by better understanding how we see and understand colour. This article by Graphiq Engineering provides to some insight into how to go about choosing colour palettes that will work with the requirement to make the data understandable and also have some aesthetic appeal.