Inspired from ploterr function, written by Brendan Hasz (haszx010@umn.edu) Apr 2018
Syntax:
ShadedPlot(meanarray,disparray,array,varargin)
Description:
ShadedPlot() - Plots the line with shaded region under the line.
Depending on the 'orientation', It is possible to have a vertical
(e.g., altitude) or horizontal (e.g., time) representation.
Inputs:
meanarray - vector for the Line (Average Data)
disparray - vector for the Shaded Region (Dispersion Data)
array - vector for the y-axis (e.g., altitude) or the x-axis (e.g., datetime)
orientation - orientation of the plot 'vertical' or 'horizontal'
varargin - Custome parameters such as color,marker, markersize, displaynames, legend location
X = [ 0.0397 0.0979 0.1479 0.1428 0.1596 0.1782 0.5229 0.2795 0.1346 0.1518 0.0685];
Y = [ 0 0.0296 0.0064 0.0230 0.0165 0.0356 0.2772 0.1100 0.0333 0.0355 0.0466];
Z = [6.0853 6.0254 5.9655 5.9057 5.8458 5.7859 5.7260 5.6662 5.6063 5.5464 5.4865];
Z2 = datetime(2023,1,1):datetime(2023,1,11);
figure;
nexttile;
ShadedPlot(X,Y,Z,'vertical'); % vertical plot
box on; grid on;
title('Vertical plot 1')
xlabel('Extinction (km^-^1)')
ylabel('Altitude (km)')
nexttile;
ShadedPlot(X,Y,Z2,'horizontal','Marker','o','Color','green'); % horizontal plot
box on; grid on;
xlabel('Time (Day)')
ylabel('Extinction (km^-^1)')
title('Horizontal plot 2')
nexttile;
ShadedPlot(X,Y,Z,'vertical','Marker','square','Color','red','Legend_Loc','south'); % vertical plot
box on; grid on;
title('Vertical plot 3')
xlabel('Extinction (km^-^1)')
ylabel('Altitude (km)')
nexttile;
ShadedPlot(X,Y,Z2,'horizontal','Marker','none','Color','orange'); % horizontal plot
box on; grid on;
xlabel('Time (Day)')
ylabel('Extinction (km^-^1)')
title('Horizontal plot 4')
Cite As
Marion Ranaivombola (2026). ShadedPlot (https://www.mathworks.com/matlabcentral/fileexchange/123055-shadedplot), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2022b
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0 |
