Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个以 xlim([1 5]) 为时间的条形图。每次包含 5 个不同的分组数据。它们非常紧凑,情节理解不清楚。我将把每个 xlim 单元扩展到每 5 个分组数据,以便每次都更具可读性。这怎么可能?
另外,我怎样才能使每5个分组数据之间的距离更远?我申请了 bar(data,10,'hist'); 但我的 5 个分组数据仍然每次都被压缩。
您可以尝试bar(X,Y,width)使用width低于默认值 0.8 的值。然而,这只会使条形变窄,而不是在其组内彼此更接近。
bar(X,Y,width)
width
要使条形组相距更远,您可以NaN在它们之间插入值。例如:
NaN
bar(1:.5:3,[ rand(1,7); repmat(NaN,1,7); rand(1,7); repmat(NaN,1,7); rand(1,7)] ,.8) set(gca,'xtick',1:3) % remove unwanted ticks
见图: