Make x axis values not overlapping

7 ビュー (過去 30 日間)
Anita Capelli
Anita Capelli 2021 年 11 月 11 日
回答済み: Dave B 2021 年 11 月 11 日
Goodafternoon,
I'm plottin some values with bar() and I have the x values that overlaps. I was wondering if there was a way to have the values on the x axis shifted among them so to not touch each other.
I'll try to make an example here after:
------------------------------------------------------------------- this is xaxis
5 7 9 11
6 8 10
thanks a lot
Anita
  2 件のコメント
Yongjian Feng
Yongjian Feng 2021 年 11 月 11 日
Maybe you just need to make your figure bigger/wider?
Anita Capelli
Anita Capelli 2021 年 11 月 11 日
But in this way i'm loosing the propotions and appear different from any other graph I have on my repor. It is impossible to shift as I showed the value?

サインインしてコメントする。

採用された回答

Dave B
Dave B 2021 年 11 月 11 日
You can make this kind of (multi-row) labelling work by relying on the TeX interpreter. Note this answer is a total rip-off of the answer here (not the accepted answer, but the one from Adam Danz).
plot(1:6)
row1 = {'1' '' '3' '' '5' ''};
row2 = {'' '2' '' '4' '' '6'};
labelArray = [row1; row2];
tickLabels = sprintf('%s\\newline%s\n', labelArray{:});
xlim([1 6])
xticks(1:6)
xticklabels(tickLabels)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by