errorplot.m

Plots error bars and legend for data.
1.8K Downloads
Updated 12 Mar 2004

No License

% 2 dimensional plot with error bars
%
% By: P.S.Basran 6/17/03
%
% Toronto-Sunnybrook Cancer Centre
% Dept. Medical Physics
% Parminder.Basran@sw.ca
%
%
%
% Function:
% This function produces a two dimensional plot with error bars.
%
% Syntax:
% out=errorplot(x,y,dy,plottypes,dx)
%
% Inputs:
% x - is a [1 x n] dimensional vector
% y - is a [m x n] dimensional matrix for multidimensional plots
% dy - is a [m x n] dimensional matrix whose dimensions must match those of y
% plottypes - is a [1 x 4] dimensional vector whose entries specify the plottype in the
% same fashion as the variable 's' in the function plot(x,y,s).
% NOTE: current version of this requires the plottype to be specified in
% all instances, and to be 4 characters in length.
% dx - is a real number that specifices the dimensions of the horizontal tics
% for each error bar. The default value is 0.25 the dimension of x.
%
% Outputs:
% - plot with legend, labeled '1', '2', etc.
%
% Example:
%
% %For a single plot:
%
% x=[-10:1:10];
% y1=x.^2;
% dy1=0.3*y1.*rand(size(x)); %
% plottype1=[': '];
% errorplot(x,y1,dy1,plottype1);
%
% % For multiple plots:
%
% y2=0.5*x.^2;
% dy2=0.2*y2.*rand(size(x)); %
% plottype2=['o-- '];
% y=[y1; y2];
% dy=[dy1; dy2];
% errorplot(x,y,dy,[plottype1 plottype2],1);
%

% Modification Log:
% June 17 - 2003: alpha version
% March 11 - 2004: fix for the plottypes ....thanks to Sean Verret

Cite As

Parminder Basran (2026). errorplot.m (https://www.mathworks.com/matlabcentral/fileexchange/3612-errorplot-m), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R10
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on 2-D and 3-D Plots in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0

March 11- 2004: fix for plottypes