0
votes

I want to separate the two graph bars shown in the below figure this is the code I'm using:res

bar(uu,nn/numel(n));
hold on
bar(uu1,nn1/numel(n1),'r');
hold off

, but I want them to be like this:enter image description here

Update: I'm using the below code suggested by Shai but the fig. is now not correct, as there is white space in the beginning and the values of the y axis are not correct : enter image description here

bar(uu-.5, nn/numel(nn), .5);hold all;bar(uu1, nn1/numel(nn1),.5,'r');
hleg = legend('Kinect','Xtion','Location','NorthEast');
1
I suggest using distributionPlot from the File Exchange for plotting/comparing multiple distributions. - Jonas
how uu and uu1 are related? - Shai
@Shai the xaxis represent the values and y-axis representing the percentage. DO you know how to separate them? - Tak
try: bar(uu-.5, nn1/numel(nn1), .5);hold all;bar(uu1, nn1/numel(nn1),.5); - Shai
my bad, I divided by numel(nn) instead of numel(n) (same for nn1). - this should fix your y-axis. - Shai

1 Answers

1
votes

A workaround can be shifting a bit the y values of the sequences:

bar(uu-.25, nn/numel(n), .5);
hold all;
bar(uu1 + .25, nn1/numel(n1),.5);
legend({'a','b'});