You cannot specify multiple colors (or line styles, or markers) when you use a single Y for plot, even when Y has multiple columns. The syntax only allows for one linespec for each Y argument, and only if you interleave them
plot(x1, y1, 'b-', x2, y2, 'g-')
If you use a property name / value pair such as 'linestyle', '-', then only the last one of those in the plot() call will be paid attention to, and it will apply to all of the values plotted.
The solution is to record the handles output by plot (note that they are not "axes" handles, they will be lineseries handles), and to set() the linestyle etc. properties for each as appropriate.
Or set the axes ColorOrder property before plotting.
The MATLAB File Exchange contribution "plt" is more flexible I understand.
0 Comments
Sign in to comment.