x-ticklabels with varying distance

I have plotted a set of samples S1, S2, S3, etc.. using
boxplot, hold on, scatter
(this part is not related to my question:)) Now I want to group every 2 sample by making them closer together on the x-axis: In other words I want to have only 1 space between S1 and S2 and 1.5 space between S2 and S3 on the x-axis. Similarly I want 1 space between S3 and S4 and 1.5 space between S4 and S5. So in this way every 2 sample is closer together on the x-axis. Is it possible to achieve this in matlab?
Thanks.

Réponses (1)

dpb
dpb le 20 Juil 2017
Yeah, just define an associated x vector on a 1:1 basis with the y values (your S arrays here) that has the appropriately-spaced distances between them, then use the
plot(x,y)
form instead of just
plot(y)
which former plots y vs x instead of the latter that is just versus the ordinal position in the array.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Question posée :

le 20 Juil 2017

Réponse apportée :

dpb
le 20 Juil 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by