Borrar filtros
Borrar filtros

scatter plot custom colors

10 visualizaciones (últimos 30 días)
Florian
Florian el 18 de Sept. de 2018
Comentada: jonas el 18 de Sept. de 2018
Assume
a=[1 5 7 1 3 9 4 6 8 7];
b=[4 5 6 7 2 6 9 4 2 1];
c=[1 2 0 1 0 2 1 1 0 1];
scatter(a,b)
How can I now color the dots using a color code from 0 to 2 corresponding to the values in c?

Respuesta aceptada

jonas
jonas el 18 de Sept. de 2018
Editada: jonas el 18 de Sept. de 2018
3rd argument is variable size and 4th is variable color.
scatter(a,b,[],c,'filled')
where 'filled' is optional.
If you want another set of colors, just set a different or custom colormap (default is parula)
  2 comentarios
Florian
Florian el 18 de Sept. de 2018
Perfect, thanks!
jonas
jonas el 18 de Sept. de 2018
My pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by