KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I would like to plot a curve in the (x,y) plane, where the color of the curve depends on a value of another variable T. x is a 1D numpy array, y is a 1D numpy array. T=np.linspace(0,1,np.size(x))**2 fig = plt.figure() ax = fig.add_subplot(111) ax.plot(x,y) I want the line to change from blue to red (using RdBu colormap) depending on the value of T (one value of T exists for every (x,y) pair). I found this, but I don't know how to warp it to my simple example. How would I use the linecollection for my example? http://matplotlib.org/examples/pylab_examples/multicolored_line.html Thanks.
Tags (comma-separated)
Save Edits
Cancel