Scatter plot- changing symbols based on colour

1 visualización (últimos 30 días)
Bran
Bran el 11 de Jul. de 2015
Comentada: Walter Roberson el 12 de Jul. de 2015
I have colour coded my scatter points based on one of my vectors. I am using the following code:
scatter(X,Y,[],VV,'filled')
I would like to use different symbols for different colours for example all red dots are squares all green are triangles etc, How do I do this?
  1 comentario
Azzi Abdelmalek
Azzi Abdelmalek el 11 de Jul. de 2015
Editada: Azzi Abdelmalek el 11 de Jul. de 2015
Can you post an example? How many colors are you using?

Iniciar sesión para comentar.

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 11 de Jul. de 2015
X=1:10
Y=sin(X)
W=randi([0 1],numel(X),3)
cl=dec2bin(1:2^3-1)-'0'
sh='os<>dv^'
figure
hold on
for k=1:numel(X)
scatter(X(k),Y(k),150,W(k,:),'filled',sh(ismember(cl,W(k,:),'rows')))
end
  1 comentario
Walter Roberson
Walter Roberson el 12 de Jul. de 2015
An essential point here is that scatter() can only use one shape at a time, so if you want multiple shapes you need to use multiple scatter() calls.

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