Matlab:间距不均匀的箱线图

请考虑以下示例,该示例在Matlab中绘制箱线图,这是我从here中摘录的。

rng('default')  % For reproducibility
x1 = rand(5,1);
x2 = rand(10,1);
x3 = rand(15,1);
x = [x1; x2; x3];
g1 = repmat({'First'},5,1);
g2 = repmat({'Second'},10,1);
g3 = repmat({'Third'},15,1);
g = [g1; g2; g3];
% Create the box plots.
boxplot(x,g)

以上将以等间隔的箱线图绘制,为此我可以更改xticks。我要对不均匀的横坐标值进行箱线图绘制,让我们说横坐标= [1.1,2.5,4.6]

谢谢

cxd345 回答:Matlab:间距不均匀的箱线图

我明白了,很简单

abscissa = [1.1,2.5,4.6]
boxplot(x,g,'positions',abscissa,'labels',abscissa )
本文链接:https://www.f2er.com/3133833.html

大家都在问