x-ticklabels with varying distance
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
dpb
2017-7-20
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Visual Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!