This function plots the mean and standard deviation of a set of data filling the space between the positive and negative mean error using a semi-transparent background, completely customizable.
- data: Data matrix, with rows corresponding to observations and columns to samples.
- options: (Optional) Struct that contains the customized params.
* options.handle: Figure handle to plot the result.
* options.color_area: RGB color of the filled area.
* options.color_line: RGB color of the mean line.
* options.alpha: Alpha value for transparency.
* options.line_width: Mean line width.
* options.x_axis: X time vector.
* options.error: Type of error to plot.
if 'std', one standard deviation;
if 'sem', standard error mean;
if 'var', one variance;
if 'c95', 95% confidence interval.
Example of use:
data = repmat(sin(1:0.01:2*pi),100,1);
data = data + randn(size(data));
Víctor Martínez-Cagigal (2019). Shaded area error bar plot (https://www.mathworks.com/matlabcentral/fileexchange/58262-shaded-area-error-bar-plot), MATLAB Central File Exchange. Retrieved .
I am having a problem with setting the x axis right. Other things seem to work fine. But the x axis is only drawn between 1 and 2. Could you help out with that please?
Below is the data I am working with. I want to plot a scatterplot with shaded confidence intervals.
a = [146.146 154.006
When I try
plot_areaerrorbar(a), the x axis is between 1 and 2. I am not able to understand how to make the plot to be the same length as my data.
Might be neater with an input parser instead of the structure for the optional arguments: https://ch.mathworks.com/help/matlab/ref/inputparser.addparameter.html
Thank you. Excellent function.
Due to changes in std() function, now calculates the proper standard deviation across observations.
Title is modified.
Now the function displays one standard deviation up and one down.