Matlab Log Plot With Error Bars
Contents |
Support Answers MathWorks Search MathWorks.com MathWorks Answers Support MATLAB Answers™ MATLAB Central Community Home MATLAB Answers File errorbarlogx Exchange Cody Blogs Newsreader Link Exchange ThingSpeak Anniversary Home Ask matlab errorbarlogx Answer Browse More Contributors Recent Activity Flagged Content Flagged as Spam Help MATLAB Central Community Home errorbarlogy 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
Matlab Errorbar Loglog
Trial software MathWorks Support Team (view profile) 13,642 questions 13,642 answers 13,641 accepted answers Reputation: 2,623 Vote0 How can I use the ERRORBAR function with a logarithmic axis in MATLAB? Asked by MathWorks Support Team MathWorks Support Team (view profile) 13,642 questions 13,642 answers 13,641 accepted answers Reputation: 2,623 on 27 Jun errorbar semilog matlab 2009 Latest activity Commented on by Ohad BarSimanTov Ohad BarSimanTov (view profile) 0 questions 0 answers 0 accepted answers Reputation: 0 on 27 Jul 2016 Accepted Answer by MathWorks Support Team MathWorks Support Team (view profile) 13,642 questions 13,642 answers 13,641 accepted answers Reputation: 2,623 297 views (last 30 days) 297 views (last 30 days) When I type the following at the MATLAB prompt, I get a an errorbar with a log x axis:x = 1:100; y = sin(x); e = std(y)*ones(size(x)); errorbar(x,y,e) set(gca,'xscale','log') However, the errorbars of the first point in the resulting figure extend much farther than the other errorbars. I would like a function that can account for the logrithmic X-axis and make all of the errorbars have a uniform width. 1 Comment Show all comments Ohad BarSimanTov Ohad BarSimanTov (view profile) 0 questions 0 answers 0 accepted answers Reputation: 0 on 27 Jul 2016 Direct link to this comment: https://www.mathw
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company errorbar matlab Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs
Horizontal Error Bars Matlab
Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just
Errorbar Matlab Example
like you, helping each other. Join them; it only takes a minute: Sign up Using errorbar() with semilogy() in MATLAB? up vote 4 down vote favorite I'd like to plot data x & y with errorbars, ebar, https://www.mathworks.com/matlabcentral/answers/99844-how-can-i-use-the-errorbar-function-with-a-logarithmic-axis-in-matlab and its fit, yfitted, on a semilog plot. This doesn't seem to work: figure; hold on; errorbar(x,y,ebar); semilogy(x,yfitted); Instead of semilog plot I get a linear plot. What should I be doing differently? math matlab plot graphing share|improve this question asked Aug 23 '10 at 17:53 AndyL 6,387103466 add a comment| 2 Answers 2 active oldest votes up vote 5 down vote accepted try h = errorbar(x,y,ebar); set(get(h,'Parent'), 'YScale', 'log') or ax = axes(); http://stackoverflow.com/questions/3550241/using-errorbar-with-semilogy-in-matlab errorbar(ax, x,y,ebar); set(ax, 'YScale', 'log'); share|improve this answer edited Aug 23 '10 at 18:15 answered Aug 23 '10 at 18:08 Marc 2,74421634 sort of works but it screws all of the errorbars up.. e.g. it fails to draw some of the vertical lines –AndyL Aug 23 '10 at 20:47 2 As you probably realize, you can't take the log of 0 or a negative number –Marc Aug 23 '10 at 22:37 add a comment| up vote 3 down vote This is what the documentation says. "If you attempt to add a loglog, semilogx, or semilogy plot to a linear axis mode graph with hold on, the axis mode will remain as it is and the new data will plot as linear" I would suggest that you just reverse the order of your plotting, that is. semilogy(x,yfitted); hold on; errorbar(x,y,ebar); share|improve this answer answered Aug 23 '10 at 18:11 Ghaul 3,14111122 I had tried that first. It doesn't actually work. :/ –AndyL Aug 23 '10 at 20:50 I'm on MATLAB R2009a –AndyL Aug 23 '10 at 20:50 It should work. Are you writing >>figure; >>hold on; before using semilogy? If you do, it wont work. Just write the three lines in my post and you'll get the same result as the answer above. &n
instant chat support from our awesome engineering team. plotly Pricing PLOTCON NYC API Sign In SIGN UP + NEW PROJECT https://plot.ly/matlab/error-bars/ UPGRADE REQUEST DEMO Feed Pricing Make a Chart API Sign In SIGN UP + NEW PROJECT UPGRADE REQUEST DEMO Show Sidebar Hide Sidebar Help API Libraries https://github.com/jaberg/SMAC_clone/blob/master/source/smbo_core/validation/errorbarloglog.m MATLAB Error Bars Fork on Github Navigation Back to MATLAB Error Bars in MATLAB How to add error bars to a line, scatter, or bar chart. Seven error bars examples of symmetric, asymmetric, horizontal, and colored error bars. matplotlib Python plotly.js Pandas node.js MATLAB Symmetric Error Bars % Learn about API authentication here: https://plot.ly/matlab/getting-started % Find your api_key here: https://plot.ly/settings/api x = 0:pi/10:pi; y = sin(x); e = std(y)*ones(size(x)); fig = figure errorbar(x,y,e) %--PLOTLY--% % Strip MATLAB style by default! response = matlab log plot fig2plotly(fig, 'filename', 'matlab-symmetric-error-bars'); plotly_url = response.url; Basic Symmetric Error Bars % Learn about API authentication here: https://plot.ly/matlab/getting-started % Find your api_key here: https://plot.ly/settings/api data = {... struct(... 'x', [0, 1, 2], ... 'y', [6, 10, 2], ... 'error_y', struct(... 'type', 'data', ... 'array', [1, 2, 3], ... 'visible', true), ... 'type', 'scatter')... }; response = plotly(data, struct('filename', 'basic-error-bar', 'fileopt', 'overwrite')); plot_url = response.url Bar Chart with Error Bars % Learn about API authentication here: https://plot.ly/matlab/getting-started % Find your api_key here: https://plot.ly/settings/api trace1 = struct(... 'x', { {'Trial 1', 'Trial 2', 'Trial 3'} }, ... 'y', [3, 6, 4], ... 'name', 'Control', ... 'error_y', struct(... 'type', 'data', ... 'array', [1, 0.5, 1.5], ... 'visible', true), ... 'type', 'bar'); trace2 = struct(... 'x', { {'Trial 1', 'Trial 2', 'Trial 3'} }, ... 'y', [4, 7, 3], ... 'name', 'Experimental', ... 'error_y', struct(... 'type', 'data', ... 'array', [0.5, 1, 2], ... 'visible', true), ... 'type', 'bar'); data = {trace1, trace2
Sign in Pricing Blog Support Search GitHub This repository Watch 2 Star 2 Fork 2 jaberg/SMAC_clone Code Issues 0 Pull requests 0 Projects 0 Pulse Graphs Permalink Branch: master Switch branches/tags Branches Tags master Nothing to show Nothing to show Find file Copy path SMAC_clone/source/smbo_core/validation/errorbarloglog.m Fetching contributors… Cannot retrieve contributors at this time Raw Blame History executable file 61 lines (52 sloc) 1.77 KB function handle=errorbarloglog(x,y,errl,errh,linestyle,marker, colour); %function handle=errorbarloglog(x,y,errl,errh); % %plots error bars in 2D loglog-plot correctly, solving the problem with %Matlab errorbar function. % %IN: %x: x-axis data vector %y: y-axis data vector %errl: vector containing errors. If only 3 input arguments are given, this %is half the height of the error bar. If four input arguments are given, %this is the lower bound error vector %errh: upper boud error vector (optional) % %OUT: axes handle % %Copyright Erik Benkler, Physikalisch-Technische Bundesanstalt %Section 4.53: Microoptics Measuring Technologies %D-38116 Braunschweig, GERMANY % %Version 0.2, November 30 2005, checked with Matlab R14SP2 (7.0.4.365) if nargin == 3 errh=y+errl; errl=y-errl; end handle=gca; set(gca,'xscale','log'); %make loglog axes set(gca,'yscale','log'); if nargin<=6 colour=[0 0 1]; end if nargin<=5 marker='none'; end if nargin<=4 linestyle='-'; end hd=line(x,y); %plot the data set(hd,'Marker', marker,'LineStyle',linestyle,'MarkerFaceColor',colour, 'Color', colour); ax=log(axis); %determine axis limits %This sets the with of the errorbar heads to 2% of the x-axis width %AS IT WILL APPEAR IN THE LOGLOG-PLOT: (modified as suggested by Phill Jones lx=log(x); werrbh=abs(0.02*(lx(1)-lx(end))); xul=[[exp(lx+werrbh)]' [exp(lx-werrbh)]']; for i=1:length(x) line([x(i) x(i)],[errl(i) errh(i)], 'Color', colour); %plot errorbars line(xul(i,:), [errl(i) errl(i)], 'Color', colour); %plot lower errorbar heads line(xul(i,:), [errh(i) errh(i)], 'Color', colour); %plot upper errorbar heads end order=get(gca,'Children'); set(gca,'Children',[hd;setdiff(order,hd)]) Jump to Line Go Contact GitHub API Training Shop Blog About © 2016 GitHub, Inc. Terms Privacy Security Status Help You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.