Borrar filtros
Borrar filtros

scatter plot for plotting categorical data

2 visualizaciones (últimos 30 días)
Kiruthiga Sekar
Kiruthiga Sekar el 13 de Feb. de 2019
Comentada: ibabinaca el 14 de Feb. de 2019
Hi,
I have a matrix in which the second row randomnly has 0s and 1s. How do I plot them with different colours and in the same scatter plot?
Thanks in Advance
  3 comentarios
Kiruthiga Sekar
Kiruthiga Sekar el 14 de Feb. de 2019
10 20 30 40 50
0 1 0 0 1
i need to plot 0s with one color and 1s with other color in the same scatter plot
ibabinaca
ibabinaca el 14 de Feb. de 2019
The fourth argument in scatter has to do with the color of the circle.https://es.mathworks.com/help/matlab/ref/scatter.html?lang=en.
Since y is a matrix with 0 and 1, if you just put y as the fourth argument it's enough.
x =[10 20 30 40 50];
y = [0 1 0 0 1];
scatter(x,y,50,y,'filled')

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Scatter Plots 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