Plotting multiple lines with difference specific colours via plot function
Show older comments
Is there any way to use the plot function to plot multiple lines, each having a specific colour?
e.g plot(x1,y1,'-','color',[0 0 1],x2,y2, '-', 'color',[1 0.4 0.6])
This doesn't work, but is there any way of properly doing this?
Answers (2)
>> map = [0,0,1;1,0.4,0.6];
>> axes('ColorOrder',map,'NextPlot','replacechildren')
>> plot([0,1],[1,2],'-',[0,1],[2,1],'*-')

Categories
Find more on Annotations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!