Info

This question is closed. Reopen it to edit or answer.

How to reorder groups and corresponding curves in scatterhist

1 view (last 30 days)
I have the following script aiming to show my data by scatterhist, properly. But it gives an awkward y-histogram, as it seems in the 'scatterhist' the curve correspond to the least frequent occurrences is plotted at the end; I mean in order. So, curves corresponding to more frequent occurrences are suppressed and do not illustrated properly. How can I fix my code.
p= 1:100;
z= zeros(1,2);
n= -1:-1:-40;
a = [z,p,n];
c={zeros(numel(a)),1};
for i= 1:numel(a)
if a(i)>0
c(i)={'p'};
elseif a(i)==0
c(i)= {'z'};
elseif a(i)<0
c(i)={'n'};
end
end
figure(1)
scatterhist(rand(1,numel(a)),a,'Group',char(c),'Marker','s..')

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!