Large dataset legend for two colours

2 Ansichten (letzte 30 Tage)
M03
M03 am 14 Okt. 2019
Kommentiert: darova am 15 Okt. 2019
I am trying to plot eeg data of 6 channels. Three channels are within the same area and other three channels are from another area. So I differentiate them with two colours. However, as I have 6 lines in overall I am able to display only a legend for 6 lines - 3 blue, 3 red, and not legend for 2 colours - blue for one area, red for the other one.
How can I change the legend so I would have only 2 descriptions - one for blue and one for red, please??
figure()
plot(tdata(startsample:endsample)-0.033,eegdata1(:,startsample:endsample),...
'Color','b');
xlim([-0.08, 0.20])
xlabel('Time')
ylabel('Field')
hold on
plot(tdata(startsample:endsample)-0.033,eegdata2(:,startsample:endsample),...
'--','Color','r');

Antworten (1)

darova
darova am 15 Okt. 2019
You can use hadlers
h1 = plot()
hold on
h2 = plot()
hold off
legend(h1,'legend red')
legend(h2,'legend blue')
  2 Kommentare
M03
M03 am 15 Okt. 2019
It doesn't work. I get legend only for the blue color
darova
darova am 15 Okt. 2019
Can you please attach the data?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu EEG/MEG/ECoG finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by