I found this technique very useful. It seemed relevant to the discussion at
http://blogs.mathworks.com/videos/2014/08/12/coloring-a-line-based-on-height-gradient-or-some-other-value-in-matlab/#comment-41206
where I posted a comment referencing to this submission. Thanks.
^ works fine up to million elements (didn't try with more).
The function does NOT refresh the plot. It only adds a new colored line.
Maybe you should clear the figure (clf).
Unfortunately in my hands this function only seems to work for x shorter than 300 elements.
For example:
x = 1:301
color_line(x,sin(x),cos(x))
never generates a plot(i.e. the plot window never refreshes.)
For x=1:300 it works beautifully though.
Is there a simply way to make it work for longer x (e.g. 2500 points).
Comment only