Error Bar Plotyy Matlab
Contents |
Support Support Newsreader MathWorks Search MathWorks.com MathWorks Newsreader Support MATLAB Newsgroup MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange ThingSpeak plotyy error bars Anniversary Home Post A New Message Advanced Search Help MATLAB Central Community matlab plt Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange ThingSpeak Anniversary Home Post A New Message matlab errorbar two y axes Advanced Search Help Trial software Plotting error bars on a two Y axis graph Subject: Plotting error bars on a two Y axis graph From: Stu Fillman Stu Fillman (view
Errorbarxy Matlab
profile) 1 post Date: 14 Jan, 2009 20:05:18 Message: 1 of 3 Reply to this message Add author to My Watch List View original format Flag as spam Hi Everyone I am using the plotyy command to create a graph with two y axes. Since there is no error bar command using this function I attempted to put hold plotyy color on and plot overtop using the errorbar command and specifying which axes I wanted. It works fine for the first (left axis) but then on the second I get an error message. ??? Error using ==> get Invalid handle object. Error in ==> nextstyle at 23 co = get(ax,'ColorOrder'); Error in ==> errorbar at 101 [ls,c,m] = nextstyle(cax,autoColor,autoStyle,k==1); Error in ==> gammapowergammacountcorr at 95 errorbar(Axis3(2),xaxisarray,meancounton(:),serr_counton(:),'go') We traced this back to the fact that errorbar itself is not supposed to take axes commands as its first argument. Does anyone out there know how I could go about plotting error bars on my YY graph? Thanks in advance for any help that can be offered. Subject: Plotting error bars on a two Y axis graph From: Paul Mennen Paul Mennen (view profile) 248 posts Date: 15 Jan, 2009 06:18:01 Message: 2 of 3 Reply to this message Add author to My Watch List View original format Flag as spam > I am using the plotyy command to create a graph with two y axes. > Since the
Support Answers MathWorks Search MathWorks.com MathWorks Answers Support MATLAB Answers™ MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange errorbar matlab ThingSpeak Anniversary Home Ask Answer Browse More Contributors Recent Activity Flagged
Matlab Plotyy
Content Flagged as Spam Help MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange ThingSpeak Anniversary Home Ask Answer Browse More Contributors Recent Activity Flagged Content Flagged as Spam Help Trial software Chris E. (view profile) 35 questions 9 answers 4 accepted answers https://www.mathworks.com/matlabcentral/newsreader/view_thread/242413 Reputation: 10 Vote0 Using plotyy with error bars and 3 sets of data... Asked by Chris E. Chris E. (view profile) 35 questions 9 answers 4 accepted answers Reputation: 10 on 2 Jul 2013 Accepted Answer by Chris E. Chris E. (view profile) 35 questions 9 answers 4 accepted answers Reputation: 10 25 views (last 30 days) 25 https://www.mathworks.com/matlabcentral/answers/80947-using-plotyy-with-error-bars-and-3-sets-of-data views (last 30 days) Hello All,I have an issue with trying to make a 2-D line plot with y-axes on both left and right side for two different number ranges for the y axis. I need error bars as well for the plot. There are 3 sets of data that are made and 2 of them are going to be on the same 1st axis and one of them is going on the 2nd axis. I have really never used the plotyy, let alone trying to make errorbars on the plotyy and doing 3 sets of data on the same plot.Here is some code that I have been playing with to try to make the the plot as of now:sliceNum = 10; figure ax = gca; for x = 1:sliceNum+1 s(x) = struct('field1',rand(1,5)*10,'field2',rand(1,5)*10+40,'field3',rand(1,5)*10); end needed = s(2:end); nums = reshape([needed.field2]',5,sliceNum); cal = [40 0.8 0.9];%need to find source AreaVal = nums(1,:).*cal(1); meanVal = nums(2,:).*cal(2); RMSVal = nums(3,:).*cal(3); numsStd = reshape([needed.field3]',5,sliceNum); AreaValStd = numsStd(1,:).*cal(1)*0.05; meanValStd = numsStd(2,:).*cal(2)*0.05; RMSValStd = numsStd(3,:).*cal(3)*0.05; errorbar(1:sliceNum,AreaVal,AreaValStd,'.-','Parent',ax); hold(ax,'on'); errorbar(1:sliceN
plots on one figure with y-axes on the left and right sides. http://openwetware.org/wiki/McClean:_Plotyy_with_Errorbar Example Examples of how to use the code: Example 1: https://groups.google.com/d/topic/comp.soft-sys.matlab/ADBCx3gBgXo Plotting two errorbar plots with the same x-axis and different y-axis M1=randn(100,10); M2=randn(100,10); x=linspace(1,10,10); [a,h1,h2]=plotyy(x,M1,x,M2,'EBplotyy','EBplotyy'); set(get(a(1),'Ylabel'),'String','Data 1') set(get(a(2),'Ylabel'),'String','Data 1') set(get(a(2),'Xlabel'),'String','Points') title('Two Errorbar Plots') Example 2: Plotting one errorbar plot and a non-errorbar plot on the same x-axis with different y axis error bar M1=randn(100,10); x=linspace(1,10,10); y=2*x; [a,h1,h2]=plotyy(x,M1,x,y,'EBplotyy','plot') set(get(a(1),'YLabel'),'String','Errorbar Plot') set(get(a(2),'YLabel'),'String','Some Other Plot') title('Errorbar Plot and some other Random Plot') set(get(a(1),'XLabel'),'String','Points') Code function h=EBplotyy(x,y) %INPUT: %x-independent variable (often Time) %y-dependent variable %OUTPUT: %h-handle of the errorbar graphics object % %Save this code in an m-file named EBplotyy.m s=nanstd(y); h=errorbar(x,nanmedian(y),nanstd(y)); %NOTE: You might want to change error bar plotyy nanmedian to nanmean, nanstd to standard error, etc depending on what you want to plot Notes Please feel free to post comments, questions, or improvements to this protocol. Happy to have your input! Megan N McClean 17:27, 30 January 2012 (EDT): Obviously this is nothing fancy, but the code has come in handy for me a number of times, so I thought I would stick it on the wiki in case it is useful to anyone else in the lab. References Mathworks Online Help: plotyy Matlab Newsreader: Plotyy with errorbar Contact Megan N McClean 14:01, 30 January 2012 (EDT) or instead, discuss this protocol. Retrieved from "http://openwetware.org/wiki/McClean:_Plotyy_with_Errorbar" Views Page Talk View source History Personal tools Log in Navigation Main Page Recent changes Help Contact OWW Add a Lab Notebook research Materials Protocols Resources Search Toolbox What links here Related changes Upload file Special pages Printable version Permanent linkCite this pageSubscribe t
von GoogleAnmeldenAusgeblendete FelderNach Gruppen oder Nachrichten suchen