Matplotlib: 2-dimensional line change line with 3rd dimension (category)

How to change the color of a regular two-dimensional plot in accordance with the third dimension / category? For example, suppose we recorded a vehicle coolant temperature over time. We build this over time along the horizontal axis and along the vertical axis. We also recorded every time the heat indicator turned on or off. When the light comes on, we want the chart to be red; green if the indicator is off.

This is basically a three-dimensional data graph where we assign a specific row color to the third data size (z). I do not want to look at a three-axis three-dimensional plot for this particular application; just a regular two-dimensional graph that changes the color of the line.

+4
source share
2 answers

Just take a look at SciPy.Cookbook.MulticoloredLine

Another approach could be: add / turn off the ColorBar at the bottom of the chart.

NTN!

+1
source

All Articles