How can I plot the indices of observation in class 1?

3 visualizaciones (últimos 30 días)
uzoma bob
uzoma bob el 4 de Sept. de 2020
Comentada: KSSV el 4 de Sept. de 2020
How can I plot indices of observation in class 1 in red on the same plot?
current code I have for class 0:
>> I = find(ttr == 0);
>> scatter(Xtr(I,1), Xtr(I,2), 10, ’b’);
>> hold on;
I need indices of observation in class 1 for be red in the same plot

Respuestas (1)

KSSV
KSSV el 4 de Sept. de 2020
Editada: KSSV el 4 de Sept. de 2020
load tremor(1).mat ;
id1 = ttr==0 ;
id2 = ttr == 1 ;
plot(Xtr(id1,1),Xtr(id1,2),'*r') ;
hold on
plot(Xtr(id2,1),Xtr(id2,2),'*b') ;
OR
scatter(Xtr(:,1),Xtr(:,2),[],ttr)
Also read about gscatter.
  6 comentarios
uzoma bob
uzoma bob el 4 de Sept. de 2020
I think the issue was I was closing the plot rather than loading the second plot
KSSV
KSSV el 4 de Sept. de 2020
Siggetsed to use gscatter. Read about it.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by