Scatter Plot with nan values
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Walter Roberson
am 23 Aug. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!