pkj
pkj

Reputation: 781

Matlab: boxplot at uneven spacing

Consider the following example for plotting boxplot in Matlab, which I have taken from 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)

The above will boxplot at equal intervals, for which I can change the xticks. What I want is to boxplot at uneven abscissa values, lets say at abscissa = [1.1, 2.5, 4.6]

Thanks

Upvotes: 0

Views: 155

Answers (1)

pkj
pkj

Reputation: 781

I got it, that was simple

abscissa = [1.1, 2.5, 4.6]
boxplot(x, g, 'positions', abscissa , 'labels', abscissa )

Upvotes: 0

Related Questions