Given pre-determined statistics (mean, standard deviation, and min/max), BOXPLOT_FROMSTATS uses errorbar.m and patch.m to create a fake box and whisker plot, similar to boxchart.m. Options include customizing colormap, width of box, and linewidth.
Sample code:
data = randn(5,10)*2+31;
means = mean(data');
stds = std(data');
mins = min(data');
maxs = max(data');
% -------------------------------------------------------------------------
lw = 1.2;
cmap = jet(length(means));
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
figure; clf; hold on;
boxplot_fromstats(gca,means,stds,mins,maxs,{'A', 'B', 'C', 'D', 'E'},...
'cmap', cmap, 'LineWidth',lw)
ylim([25 38])
ylabel('Temperature (^oC)')
grid on; box on;
set(gca, 'FontSize', 14)
引用格式
Allison Ho (2024). boxplot_fromstats (https://www.mathworks.com/matlabcentral/fileexchange/119888-boxplot_fromstats), MATLAB Central File Exchange. 检索来源 .
MATLAB 版本兼容性
创建方式
R2022b
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0 |