Adding the mean in a scatter plot

72 visualizaciones (últimos 30 días)
rej
rej el 4 de Mzo. de 2015
Comentada: Jose Rego Terol el 29 de Jul. de 2020
Hello, I have 2 columns matrix(x, y) and have plotted them into a scatter plot. I would also like to add a marker (different from the rest of the markers in the scatterplot, e.g. a cross istead of circles) that shows the mean value of x and y.
Really thankful for help in this!

Respuestas (1)

Star Strider
Star Strider el 4 de Mzo. de 2015
This plots the data with blue circles and the mean with a red +:
x = rand(1,25);
y = rand(1,25);
xmean = mean(x);
ymean = mean(y);
figure(1)
scatter(x, y, 'o')
hold on
plot(xmean, ymean, '+r')
hold off
  1 comentario
Jose Rego Terol
Jose Rego Terol el 29 de Jul. de 2020
Hi Star Strider,
I have 11 dots for one group, and I would like to plot the dots at the same X-axis value. Then, plot the mean of these plot and the standard error. I have run the code and it is close what I was looking for. I attached a picture of what I want to do.
Also, in the future, I would need to plot several groups in the same figure. Like a bar figure, but using dots instead. How can I plot different dots with keeping a distancing between the groups?
Best,

Iniciar sesión para comentar.

Categorías

Más información sobre Discrete Data 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