Scatter Plot with nan values
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi
I have 3 groups, say A, B and C in separate arrays of dimensions say 20 by 1, 30 by 1 and 50 by 1 respectively. I want to plot a scatter plot of these values with a line indicating the mean. How can this be done. When I join A,B and C to fill up empty spaces by nan values, i am unable to get the scatter plot. Any simple code to plot the scatter plot and mean?
0 Commenti
Risposte (1)
Walter Roberson
il 23 Ago 2016
You cannot scatter plot those. scatter plot requires 2 dimensions, but you only have one dimension.
Perhaps you want something like
hA = scatter( 1 * ones(length(A),1), A);
hold on
hB = scatter( 2 * ones(length(B),1), B);
hC = scatter( 3 * ones(length(C),1), C);
m = mean([A; B; C]);
hm = line([1 3], [m m])
legend([hA, hB, hC, hm], {'A', 'B', 'C', 'mean'});
Or perhaps you just want to use boxplot()
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Distribution Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!