Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Space between bars in hist plot

Asked by John

John (view profile)

on 11 Jan 2013
Accepted Answer by Daniel

Daniel (view profile)

Hi,

I am using the code below to generate a plot like this.

x = randn(30,1);
[y2,x2] = ecdf(x);
[y1,x1] = hist(x);
plotyy(x1,y1,x2,y2,@(x,y)bar(x,y,1,'c'),'stairs')

Would anybody know how to get a space between the bars like the example?

Many thanks

0 Comments

John

John (view profile)

Tags

Products

No products are associated with this question.

1 Answer

Answer by Daniel

Daniel (view profile)

on 11 Jan 2013
Accepted answer

You are looking for the BarWidth property

plotyy(x1,y1,x2,y2,@(x,y)bar(x,y,1,'c', 'barwidth', 0.9),'stairs')

1 Comment

John

John (view profile)

on 11 Jan 2013

Thank you

Daniel

Daniel (view profile)

Contact us