I have a graph with 18 horizontal lines, I need to first 6 lines to be colored magenta, the following 6 to be cyan and the last 6 to be red. Then I want to add a small label to that graph saying something like [0-6 = A], [6-12 = B] and [12-18 = C].
Is this possible?
No products are associated with this question.
Yes. Use the 'Color' option in line()
x1 = 0; x2 = 20;
for y = 1 : 6 line([x1 x2], [y y], 'Color', 'm'); hold on; end for y = 7 : 12 line([x1 x2], [y y], 'Color', 'c'); end for y = 13 : 18 line([x1 x2], [y y], 'Color', 'r'); end
Play games and win prizes!Learn more