x-ticklabels with varying distance
1 view (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
dpb
on 20 Jul 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.
0 Comments
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!