From: jens on 15 Apr 2010 10:07 Hello Everybody I have the following code: e1=[10 30 40] e2=[20 30 40] y=[10 200 ; 20 300; 30 300] f1 = @(x, y) bar(x, y,'group'); f2 = @(x, y) bar(x, y,'group'); [AX,H1,H2]=plotyy(1:length(y(:,1)),y,1:length(y(:,1)),y,f1) get([AX(1) AX(2)],'xtick') hold on plotyy(y(:,1),e1,y(:,2),e2,'errorbar') I have a problem with the bar axes. One of the axis should show values between [0 30] and the other axis should show values between [0 300]. I also want that every column shows a standard deviation.
From: jens on 16 Apr 2010 01:32 "jens " <storebonghoved(a)hotmail.com> wrote in message <hq76i9$htt$1(a)fred.mathworks.com>... > Hello Everybody > > I have the following code: > > e1=[10 30 40] > e2=[20 30 40] > y=[10 200 ; 20 300; 30 300] > f1 = @(x, y) bar(x, y,'group'); > f2 = @(x, y) bar(x, y,'group'); > [AX,H1,H2]=plotyy(1:length(y(:,1)),y,1:length(y(:,1)),y,f1) > get([AX(1) AX(2)],'xtick') > hold on > plotyy(y(:,1),e1,y(:,2),e2,'errorbar') > > I have a problem with the bar axes. One of the axis should show values between [0 30] and the other axis should show values between [0 300]. I also want that every column shows a standard deviation. Hey Somebody that can help? Best Regards Jens
From: Cris Luengo on 16 Apr 2010 05:04 "jens " <storebonghoved(a)hotmail.com> wrote in message <hq8son$dq6$1(a)fred.mathworks.com>... > "jens " <storebonghoved(a)hotmail.com> wrote in message <hq76i9$htt$1(a)fred.mathworks.com>... > > Hello Everybody > > > > I have the following code: > > > > e1=[10 30 40] > > e2=[20 30 40] > > y=[10 200 ; 20 300; 30 300] > > f1 = @(x, y) bar(x, y,'group'); > > f2 = @(x, y) bar(x, y,'group'); > > [AX,H1,H2]=plotyy(1:length(y(:,1)),y,1:length(y(:,1)),y,f1) > > get([AX(1) AX(2)],'xtick') > > hold on > > plotyy(y(:,1),e1,y(:,2),e2,'errorbar') > > > > I have a problem with the bar axes. One of the axis should show values between [0 30] and the other axis should show values between [0 300]. I also want that every column shows a standard deviation. > > > Hey > > Somebody that can help? You're not getting help because people have no idea what you're trying to accomplish. :) You plot the same data twice, on top of each other, in the first PLOTYY command. What is the purpose of this? If you then scale the two axes differently (which you can do with set(AX(1),'ylim',[0,30]);set(AX(2),'ylim',[0,300]) ), you won't be able to make sense at all of your data, since the left-axis bar plot will completely hide the right-axis one. If you want to add error bars to your bar plot, you shouldn't use a second PLOTYY, since this will create an additional 2 independent axes. Try rewriting the f1 @function to do bar(...);hold on;errorbar(...) . Cheers!
From: jens on 16 Apr 2010 07:37 "Cris Luengo" <cris.luengo(a)google.for.my.name.to.contact.me> wrote in message <hq9968$38e$1(a)fred.mathworks.com>... > "jens " <storebonghoved(a)hotmail.com> wrote in message <hq8son$dq6$1(a)fred.mathworks.com>... > > "jens " <storebonghoved(a)hotmail.com> wrote in message <hq76i9$htt$1(a)fred.mathworks.com>... > > > Hello Everybody > > > > > > I have the following code: > > > > > > e1=[10 30 40] > > > e2=[20 30 40] > > > y=[10 200 ; 20 300; 30 300] > > > f1 = @(x, y) bar(x, y,'group'); > > > f2 = @(x, y) bar(x, y,'group'); > > > [AX,H1,H2]=plotyy(1:length(y(:,1)),y,1:length(y(:,1)),y,f1) > > > get([AX(1) AX(2)],'xtick') > > > hold on > > > plotyy(y(:,1),e1,y(:,2),e2,'errorbar') > > > > > > I have a problem with the bar axes. One of the axis should show values between [0 30] and the other axis should show values between [0 300]. I also want that every column shows a standard deviation. > > > > > > Hey > > > > Somebody that can help? > > You're not getting help because people have no idea what you're trying to accomplish. :) > > You plot the same data twice, on top of each other, in the first PLOTYY command. What is the purpose of this? If you then scale the two axes differently (which you can do with set(AX(1),'ylim',[0,30]);set(AX(2),'ylim',[0,300]) ), you won't be able to make sense at all of your data, since the left-axis bar plot will completely hide the right-axis one. > > If you want to add error bars to your bar plot, you shouldn't use a second PLOTYY, since this will create an additional 2 independent axes. Try rewriting the f1 @function to do bar(...);hold on;errorbar(...) . > > Cheers! Thank you very much Chris I know the example above is not the best. I have two dataseries y1=[10;20;30] and y2=[200;300;300]. I want to create a barplot from the two dataseries and have two y-axes one for each dataserie. That is why I used plotyy. At the same time I want the standard deviation of each of the bars to be shown. Something like the example under, but the standard deviation of bar 4-6 are not right shown. What do you mean with "rewriting the f1 @function"? x=1:3 y1=[10 20 30] y=[200 300 300] y_all=[y y1] std=[1 2 3 4 5 6] [AX,H1,H2]=plotyy(x, y, x+length(x)+1, y1, 'bar') set(H1,'FaceColor','g'); hold on errorbar([1:6],y_all,std,'+r') Best Regards Jens
From: Steven Lord on 16 Apr 2010 09:45 "jens " <storebonghoved(a)hotmail.com> wrote in message news:hq9i51$qd3$1(a)fred.mathworks.com... > "Cris Luengo" <cris.luengo(a)google.for.my.name.to.contact.me> wrote in > message <hq9968$38e$1(a)fred.mathworks.com>... >> "jens " <storebonghoved(a)hotmail.com> wrote in message >> <hq8son$dq6$1(a)fred.mathworks.com>... >> > "jens " <storebonghoved(a)hotmail.com> wrote in message >> > <hq76i9$htt$1(a)fred.mathworks.com>... >> > > Hello Everybody >> > > >> > > I have the following code: >> > > >> > > e1=[10 30 40] >> > > e2=[20 30 40] >> > > y=[10 200 ; 20 300; 30 300] >> > > f1 = @(x, y) bar(x, y,'group'); >> > > f2 = @(x, y) bar(x, y,'group'); >> > > [AX,H1,H2]=plotyy(1:length(y(:,1)),y,1:length(y(:,1)),y,f1) >> > > get([AX(1) AX(2)],'xtick') >> > > hold on >> > > plotyy(y(:,1),e1,y(:,2),e2,'errorbar') >> > > >> > > I have a problem with the bar axes. One of the axis should show >> > > values between [0 30] and the other axis should show values between >> > > [0 300]. I also want that every column shows a standard deviation. >> > >> > >> > Hey >> > >> > Somebody that can help? >> >> You're not getting help because people have no idea what you're trying to >> accomplish. :) >> >> You plot the same data twice, on top of each other, in the first PLOTYY >> command. What is the purpose of this? If you then scale the two axes >> differently (which you can do with >> set(AX(1),'ylim',[0,30]);set(AX(2),'ylim',[0,300]) ), you won't be able >> to make sense at all of your data, since the left-axis bar plot will >> completely hide the right-axis one. >> >> If you want to add error bars to your bar plot, you shouldn't use a >> second PLOTYY, since this will create an additional 2 independent axes. >> Try rewriting the f1 @function to do bar(...);hold on;errorbar(...) . >> >> Cheers! > > Thank you very much Chris > > I know the example above is not the best. I have two dataseries > y1=[10;20;30] and y2=[200;300;300]. I want to create a barplot from the > two dataseries and have two y-axes one for each dataserie. That is why I > used plotyy. At the same time I want the standard deviation of each of the > bars to be shown. Something like the example under, but the standard > deviation of bar 4-6 are not right shown. What do you mean with "rewriting > the f1 @function"? Write your own function that satisfies the conditions set out in PLOTYY for the fifth and sixth input arguments [referred to as FUN, FUN1, and FUN2 in the help for PLOTYY] and that plots your dataseries and the corresponding error bars. Pass a handle to that function into PLOTYY as the fifth (and sixth if necessary) input. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
Next
|
Last
Pages: 1 2 3 Prev: Multiplication of multidimensional arrays and computation speed Next: Centre y to x==0 in plot |