Stuart’s MATLAB Videos

Watch and Learn

Making a Multi-color Line in MATLAB 5

Posted by Doug Hull,

This video is a follow on to last week’s. Instead of making a line with different colored markers in MATLAB, we will be making a multi-color line in MATLAB. This is actually stretchig the truth a little since lines have exactly one color in MATLAB. What we really are doing is making a function that will me a series of lines, each with a different color. The overall effect though is to have the appearance of a multi-color line.

5 CommentsOldest to Newest

Amro replied on : 1 of 5
Here is a related question on Stack Overflow: http://stackoverflow.com/questions/11855011/plot3-line-color-based-on-value
Camilo replied on : 3 of 5
This method is easier than making a function, and it is applicable to 2D as well. Just create the Z-coordinate as zeros. http://stackoverflow.com/questions/11855011/plot3-line-color-based-on-value Sincerely, Camilo Giraldo
Stuart McGarrity replied on : 5 of 5
Click the "Dock Figure" icon in the top right of a figure. Do it with multiple figures.