Plotyy with bars stacked

3 views (last 30 days)
Giorgos Papakonstantinou
Giorgos Papakonstantinou on 4 Jun 2013
I am trying to do a matlab plot with two y axes. I want both to plots to be of type 'bars'. I can't work out how to make them stacked an how to hace axes going from 1:3 with out overlapping each other.
Here's what I do.
y = {rand(x, 1) * 100; (-0:(0.8)/(x-1):0.8)'};
fn1=@(x,y) bar(x , y, 0.3, 'FaceColor','r');
fn2=@(x,y) bar(x , y, 0.3, 'FaceColor','b');
[ax, hbar1, hbar2]=plotyy(1:2:6, y{1},2:2:6,y{2} ,fn1,fn2);

Answers (0)

Categories

Find more on Two y-axis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!