How to combine 2 graphs in one legend entry?
Show older comments
Hello, i have 6 arrays of data that i want to plot but each 2 are combined. I already changed the colour of each plots so they fit together in my figure but now i have the problem that the legend doesn't works how i want to. The colours don't match.
Here's my code.
I want
plot(t_1,CH0_1,'r');
title('Measurement');
hold on;
plot(t_2,CH0_2,'r');
hold on;
% T1 and T2 combined together
plot(t_8,CH0_8,'m');
hold on;
plot(t_7,CH0_7,'m');
hold on;
% T7 and T8 combined together
plot(t_10,CH0_10,'b');
hold on;
plot(t_11,CH0_11,'b');
% T11 and T12 combined together
legend('Data1','Data2','Data3'); % Legend for all plots
Currently it looks like this. I want a legend where Data1 is red, Data2 magenta and Data 3 blue.
Can anyone help me here?

Accepted Answer
More Answers (0)
Categories
Find more on Legend 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!