violin plot
this function creates simple violin plots by estimating the kernel density, using matlabs default ksdensity(). given a matrix or table with m columns, you will get violins for each of the columns.
key features:
a) specify plotting features as facecolor, edgecolor, etc.
b) provide data with variable column length as cells if wanted, e.g. y = [100x1 double] [10x1 double]
c) plot violins on the desired x-position
notes:
1) this function is not perfect. please modify it as you like.
2) please do consider the function by jonas: "violin plots for plotting multiple distributions (distributionplot.m)" which gets you the histograms as shape.
3) please note: kernel density is estimated with ksdensity which uses a gaussian kernel by default. although the bandwidth is optimal according to the rule of thumb, it is however estimated separately for each violin. for publications, etc., please consider that you might need to use the same kernel bandwidths for all data-subsets in order to be able to really compare the distributions.
a beautiful example is given here:
引用格式
holger hoffmann (2023). violin plot (https://www.mathworks.com/matlabcentral/fileexchange/45134-violin-plot), matlab central file exchange. 检索来源 .
matlab 版本兼容性
平台兼容性
windows macos linux类别
- > > > >
标签
致谢
参考作品:
community treasure hunt
find the treasures in matlab central and discover how the community can help you!
start hunting!探索实时编辑器
创建集代码、输出和格式化文本于一体的可执行脚本文档。
版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.7.0.0 | title changed
|
|
|
1.6.0.0 | when providing x, axis was set incorrectly previously. this is fixed now. |
|
|
1.5.0.0 | - changed varargin list to parameter-value combination list
|
|
|
1.4.0.0 | - removed unnecessary text display |
|
|
1.1.0.0 | removed: set(gcf,'color','w','position',[2000 100 800 600])
|
|
|
1.0.0.0 |
|