How to plot a gradient color line in matplotlib?

To state it in a general form, I’m looking for a way to join several points with a gradient color line using matplotlib, and I’m not finding it anywhere.
To be more specific, I’m plotting a 2D random walk with a one color line. But, as the points have a relevant sequence, I would like to look at the plot and see where the data has moved. A gradient colored line would do the trick. Or a line with gradually changing transparency.

2D grid data visualization in Python

I need to visualize some data. It’s basic 2D grid, where each cell have float value. I know how to e.g. assign color to value and paint grid in OpenCV. But the point here is that there are so many values so it’s nearly impossible to do that. I am looking for some method, where I could use gradient. For example value -5.0 will be represented by blue, 0 – black, and +5.0 as red. Is there any way to do that in Python?