How to create a scatter plot with multiple Y values for each X?

26 visualizaciones (últimos 30 días)
JoeB
JoeB el 21 de Mzo. de 2018
Comentada: Jules Ray el 21 de Mzo. de 2018
I'm trying to create a scatter plot with 3 values of Y for each X. X is a group value for each person. e.g. X=10 means there are 10 people, and for each person I want to plot 3 values. I attached an image of an example that I'm trying to basically the same exact thing.
I made a vector for X and I have a matrix with all of the values of the 3 features that I want to plot for each person, but not sure how to group it like the picture.

Respuestas (1)

Jules Ray
Jules Ray el 21 de Mzo. de 2018
Editada: Jules Ray el 21 de Mzo. de 2018
If I understand you want to repeat single values of Y for each X
for instance, if you have x=[1,2,3,4,5,6,7,8,9,10] then you want 3 values for each X then your Y matrix will be 30 elements.
I reccomend repeating values of x three times, e.g:
X=[1,1,1,2,2,2,3,3,3,...]
Y=[5,7,9,3,2,1,4,5,6....] here 5,7 and 9 share the same X=1 and so on
VG
  2 comentarios
JoeB
JoeB el 21 de Mzo. de 2018
thanks for your input. With this method i'm worried that it will just stack the plots on top of each other. if i have a point with a standard deviation plotted with an error bar (as in figure) and you use the same X i worry it will stack all 3 points and errors on top of each other and you won't be able to see anything
Jules Ray
Jules Ray el 21 de Mzo. de 2018
check aboxplot you can make this grouping but using boxplots instead of scatter, maybe helps.
VG

Iniciar sesión para comentar.

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