This question was asked by me and others a month or so ago, and nobody
replied with a way to do this (besides given the plot command multiple
times, of course). So for now I am afraid that that is your only
option. If anybody knows a better way, let us know please!
Date: Sat, 17 Sep 2005 02:16:25 +0200
From: Petr <petr@…795…>
Reply-To: Petr <petr@…795…>
Subject: [Matplotlib-users] one line - multiple colors
I was investigating archives, but I didn’t find answer to my question.
I would like to plot the line which interconnects the GPS track points
(latitude and longitude coordinates) recorded by GPS receiver. It is
not so difficult. What I am not able to do is to change the color of
the line according to the speed reached on the way from point to
point. I would like to use the color of the line to differentiate the
speed as following:
speed >50 and <=90km/h
speed >90 and <=130km/h
According to the matplotlib web: “If you make multiple lines with one
plot command, the kwargs apply to all those lines”. So I am able to
set the different color arguments while plotting the tuple of the x and y points.
I would like to get something like following code:
(data is not real of course, it is for demonstration purposes only)
Many thks for your suggestions.