How can I specify axis spacing?

35 ビュー (過去 30 日間)
Susan
Susan 2019 年 6 月 12 日
コメント済み: Star Strider 2019 年 6 月 12 日
Hey Guys,
I am plotting a figure that x takes values of [4 8 16 32 64 128 256 512 1024]. I use
%%
x = [4 8 16 32 64 128 256 512 1024];
plot(x, Y)
set(gca,'XTick',x)
The problem is the x-axis = [4 8 16 32 ] overlap and it's not readable. How can I fixed that? Many thanks in advance!untitled.jpg
  2 件のコメント
Jan
Jan 2019 年 6 月 12 日
Use a logarithmic scale. Then the ticks are equi-distant.
Susan
Susan 2019 年 6 月 12 日
Thank you so much! Could you please take a look at the following comment and let me know if you have any sugesstions? Thanks in advance!

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

採用された回答

Star Strider
Star Strider 2019 年 6 月 12 日
One option:
x = [4 8 16 32 64 128 256 512 1024];
plot(log2(x), Y)
set(gca,'XTick',log2(x), 'XTickLabel',x)
It would be a bit easier if we knew ‘Y’, and what you wnat it to look like.
  4 件のコメント
Susan
Susan 2019 年 6 月 12 日
Thank you SO much!
Star Strider
Star Strider 2019 年 6 月 12 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by