How to change color of vectors when plot a matrix?
6 views (last 30 days)
Show older comments
I have plot(Y) where Y is a matrix
How do I change resulted color and line pattern for each vector inside Y? Many thanks!
0 Comments
Answers (3)
Image Analyst
on 27 Sep 2015
See my colororder demo, attached. You can make the lines be any color you want by changing the "ColorOrder".
0 Comments
Stephen23
on 27 Sep 2015
Edited: Stephen23
on 27 Sep 2015
Set the axes colororder property (here the colormap is winter, but you can choose the colormap to suit):
N = 6;
axes('ColorOrder',winter(N),'NextPlot','replacechildren')
X = linspace(0,pi*3,1000);
Y = bsxfun(@(x,n)n*sin(x+2*n*pi/N), X.', 1:N);
plot(Y)
0 Comments
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!