MATLAB中的Beeswarm箱线图(用于分类数据的散点图) [英] Beeswarm boxplot (scatterplot for categorical data) in MATLAB

查看:803
本文介绍了MATLAB中的Beeswarm箱线图(用于分类数据的散点图)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找创建所谓的Beeswarm箱线图的函数.这是在医学和生物学中非常流行的绘图,令我惊讶的是没有为MATLAB找到它.

基本上,每组的数值数据都被划分为二进制数,点的抖动取决于特定二进制数中的点数.

以下是使用R使用 BEESWARM 函数的示例:

附加组的不同颜色是非常不错的功能,但现在我不需要了.

解决方案

文件交换上有一个名为 plotSpread 可以进行以下绘制:

plotSpread({rand(100,1),randn(100,1)})

       data = [randn(50,1);randn(50,1)+3.5]*[1 1];
       catIdx = [ones(50,1);zeros(50,1);randi([0,1],[100,1])];
       plotSpread(data,'categoryIdx',catIdx,...
            'categoryMarkers',{'o','+'},'categoryColors',{'r','b'})

I am looking for a function to create a so called Beeswarm boxplot. This is very popular plots used in medicine and biology and I was surprised not to find it for MATLAB.

Basically the numerical data for each group are splitted to bins and jitter of points depends on number of points in a particular bin.

Here is an example done with R using BEESWARM function:

Different colors for additional group is very nice feature but it not needed for me now.

解决方案

There is a function on the file exchange called plotSpread that can do these plots:

plotSpread({rand(100,1),randn(100,1)})

       data = [randn(50,1);randn(50,1)+3.5]*[1 1];
       catIdx = [ones(50,1);zeros(50,1);randi([0,1],[100,1])];
       plotSpread(data,'categoryIdx',catIdx,...
            'categoryMarkers',{'o','+'},'categoryColors',{'r','b'})

这篇关于MATLAB中的Beeswarm箱线图(用于分类数据的散点图)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆