How do I change the color of a regular 2-D plot according to a third dimension/category? For example, suppose we recorded the coolant temperature of a vehicle with time. We plot that with time on the horizontal axis, and temp on the vertical axis. We also recorded at each time whether the "high temp indicator light" was on or off. When the light was on, we want the plotted light to be red; green if the indicator was off.
It's basically a plot of 3-D data where we assign a particular color of line to the third data dimension (z). I do not want to look at a 3-D plot with 3 axes for this particular application; just a regular 2-D plot changing the line color as appropriate.
Just look at SciPy.Cookbook.MulticoloredLine
Another approach could be - add on/off ColorBar in the bottom of plot.
hth!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With